#include <minix/ipc.h>
#endif
+#include <minix/u64.h>
+
#ifndef _DEVIO_H
#include <minix/devio.h>
#endif
void *ctl_ptr, void *mem_ptr) );
_PROTOTYPE( int sys_profbuf, (void *ctl_ptr, void *mem_ptr) );
+/* read_tsc() and friends. */
+_PROTOTYPE( void read_tsc_64, (u64_t *t) );
+_PROTOTYPE( void read_tsc, (u32_t *hi, u32_t *lo) );
#endif /* _SYSLIB_H */
.define _reset ! reset the system
.define _idle_task ! task executed when there is no work
.define _level0 ! call a function at level 0
-.define _read_tsc ! read the cycle counter (Pentium and up)
.define _read_cpu_flags ! read the cpu flags
.define _read_cr0 ! read cr0
.define _write_cr0 ! write a value in cr0
ret
-!*===========================================================================*
-!* read_tsc *
-!*===========================================================================*
-! PUBLIC void read_tsc(unsigned long *high, unsigned long *low);
-! Read the cycle counter of the CPU. Pentium and up.
-! This function clobbers edx and eax.
-.align 16
-_read_tsc:
-.data1 0x0f ! this is the RDTSC instruction
-.data1 0x31 ! it places the TSC in EDX:EAX
- push ebp
- mov ebp, 8(esp)
- mov (ebp), edx
- mov ebp, 12(esp)
- mov (ebp), eax
- pop ebp
- ret
-
!*===========================================================================*
!* read_flags *
!*===========================================================================*
! Read the cycle counter of the CPU. Pentium and up.
.align 16
_read_tsc:
+ push edx
+ push eax
.data1 0x0f ! this is the RDTSC instruction
.data1 0x31 ! it places the TSC in EDX:EAX
push ebp
- mov ebp, 8(esp)
+ mov ebp, 16(esp)
mov (ebp), edx
- mov ebp, 12(esp)
+ mov ebp, 20(esp)
mov (ebp), eax
pop ebp
+ pop eax
+ pop edx
ret
--- /dev/null
+
+#include "sysutil.h"
+#include <minix/u64.h>
+#include <minix/syslib.h>
+
+/* Utility function to work directly with u64_t
+ * By Antonio Mancina
+ */
+PUBLIC void read_tsc_64(t)
+u64_t* t;
+{
+ u32_t lo, hi;
+ read_tsc (&hi, &lo);
+ *t = make64 (lo, hi);
+}
+