add time of day register routine; (Chris Torek)
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Sat, 24 Oct 1987 03:03:40 +0000 (19:03 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Sat, 24 Oct 1987 03:03:40 +0000 (19:03 -0800)
SCCS-vsn: sys/vax/vax/machdep.c 7.9

usr/src/sys/vax/vax/machdep.c

index 1f05b1d..a5bbd3c 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)machdep.c   7.8 (Berkeley) %G%
+ *     @(#)machdep.c   7.9 (Berkeley) %G%
  */
 
 #include "reg.h"
  */
 
 #include "reg.h"
@@ -1289,3 +1289,33 @@ initcpu()
                break;
        }
 }
                break;
        }
 }
+
+/*
+ * Return a reasonable approximation to a time-of-day register.
+ * More precisely, return a number that increases by one about
+ * once every ten milliseconds.
+ */
+todr()
+{
+       switch (cpu) {
+
+#if VAX8600 || VAX8200 || VAX780 || VAX750 || VAX730
+       case VAX_8600:
+       /* case VAX_8200: */
+       case VAX_780:
+       case VAX_750:
+       case VAX_730:
+               return (mfpr(TODR));
+#endif
+
+#if VAX630
+       case VAX_630:
+               /* XXX crude */
+               { static int t; DELAY(10000); return (++t); }
+#endif
+
+       default:
+               panic("todr");
+       }
+       /* NOTREACHED */
+}