1/* */ 2/* sections */ 3#include <machine/asm.h> 4 5/**===========================================================================* */ 6/* PUBLIC void read_tsc(unsigned long *high, unsigned long *low); */ 7/* Read the cycle counter of the CPU. Pentium and up. */ 8ENTRY(read_tsc) 9 push %edx 10 push %eax 11.byte 0x0f /* this is the RDTSC instruction */ 12.byte 0x31 /* it places the TSC in EDX:EAX */ 13 push %ebp 14 movl 16(%esp), %ebp 15 movl %edx, (%ebp) 16 movl 20(%esp), %ebp 17 movl %eax, (%ebp) 18 pop %ebp 19 pop %eax 20 pop %edx 21 ret 22 23/**===========================================================================* */ 24/* PUBLIC void read_host_time_ns(unsigned long *high, unsigned long *low); */ 25/* access real time in ns from host in vmware. */ 26ENTRY(read_host_time_ns) 27 pushl %edx 28 pushl %eax 29 pushl %ecx 30 movl $0x10001, %ecx 31.byte 0x0f /* this is the RDTSC instruction */ 32.byte 0x31 /* it places the TSC in EDX:EAX */ 33 pushl %ebp 34 movl 20(%esp), %ebp 35 movl %edx, (%ebp) 36 movl 24(%esp), %ebp 37 movl %eax, (%ebp) 38 popl %ebp 39 popl %ecx 40 popl %eax 41 popl %edx 42 ret 43