28 #include <l4/sys/l4int.h> 39 #define L4_TSC_INIT_AUTO 0 40 #define L4_TSC_INIT_KERNEL 1 41 #define L4_TSC_INIT_CALIBRATE 2 190 (
".byte 0x0f, 0x31 \n\t" 191 "mov $0xffffffff, %%rcx \n\t" 192 "and %%rcx,%%rax \n\t" 193 "shlq $32,%%rdx \n\t" 194 "orq %%rdx,%%rax \n\t" 210 __asm__ __volatile__ (
212 "mov $0xffffffff, %%rcx \n\t" 213 "and %%rcx,%%rax \n\t" 214 "shlq $32,%%rdx \n\t" 215 "orq %%rdx,%%rax \n\t" 217 "=a" (v),
"=c"(dummy)
232 __asm__ __volatile__ (
234 "mov $0xffffffff, %%rcx \n\t" 235 "and %%rcx,%%rax \n\t" 236 :
"=a" (x),
"=c"(dummy)
250 __asm__ __volatile__ (
251 ".byte 0x0f, 0x31\n\t" 266 "shrd $27, %%rdx, %%rax \n\t" 267 :
"=a" (ns),
"=d"(dummy)
280 "shrd $32, %%rdx, %%rax \n\t" 281 :
"=a" (ns),
"=d" (dummy)
293 "shrd $27, %%rdx, %%rax \n\t" 294 "xorq %%rdx, %%rdx \n\t" 296 :
"=a" (*s),
"=&d" (*ns)
297 :
"a" (tsc),
"r" ((
l4_uint64_t)l4_scaler_tsc_to_ns),
309 "shrd $27, %%rdx, %%rax \n\t" 310 :
"=a" (tsc),
"=d" (dummy)
l4_cpu_time_t l4_rdpmc(int nr)
Return current value of CPU-internal performance measurement counter.
l4_uint32_t l4_calibrate_tsc(l4_kernel_info_t *kip)
Calibrate scalers for time stamp calculations.
l4_uint32_t l4_rdpmc_32(int nr)
Return the least significant 32 bit of a performance counter.
l4_cpu_time_t l4_ns_to_tsc(l4_uint64_t ns)
Convert nano seconds into CPU ticks.
#define EXTERN_C_END
End section with C types and functions.
l4_cpu_time_t l4_rdtsc(void)
Read current value of CPU-internal time stamp counter.
l4_uint64_t l4_tsc_to_us(l4_cpu_time_t tsc)
Convert time stamp into micro seconds value.
void l4_busy_wait_us(l4_uint64_t us)
Wait busy for a small amount of time.
L4 compiler related defines.
L4 Kernel Interface Page.
l4_uint64_t l4_cpu_time_t
CPU clock type.
Kernel Info Page access functions.
#define EXTERN_C_BEGIN
Start section with C types and functions.
void l4_tsc_to_s_and_ns(l4_cpu_time_t tsc, l4_uint32_t *s, l4_uint32_t *ns)
Convert time stamp to s.ns value.
#define L4_TSC_INIT_AUTO
Automatic init.
#define L4_CV
Define calling convention.
l4_uint32_t l4_tsc_init(int constraint, l4_kernel_info_t *kip)
Initialitze scaler for TSC calicaltions.
l4_uint32_t l4_get_hz(void)
Get CPU frequency in Hz.
l4_uint64_t l4_tsc_to_ns(l4_cpu_time_t tsc)
Convert time stamp to ns value.
unsigned long long l4_uint64_t
Unsigned 64bit value.
l4_uint32_t l4_rdtsc_32(void)
Read the lest significant 32 bit of the TSC.
unsigned int l4_uint32_t
Unsigned 32bit value.
void l4_busy_wait_ns(l4_uint64_t ns)
Wait busy for a small amount of time.