30 #include <l4/sys/l4int.h> 41 #define L4_TSC_INIT_AUTO 0 42 #define L4_TSC_INIT_KERNEL 1 43 #define L4_TSC_INIT_CALIBRATE 2 193 ".byte 0x0f, 0x31 \n\t" 210 __asm__ __volatile__ (
211 ".byte 0x0f, 0x31\n\t" 224 __asm__ __volatile__ (
241 __asm__ __volatile__ (
257 "movl %%edx, %%ecx \n\t" 259 "movl %%ecx, %%eax \n\t" 260 "movl %%edx, %%ecx \n\t" 262 "addl %%ecx, %%eax \n\t" 263 "adcl $0, %%edx \n\t" 264 "shld $5, %%eax, %%edx \n\t" 265 "shll $5, %%eax \n\t" 269 "g" (l4_scaler_tsc_to_ns)
281 "movl %%edx, %%ecx \n\t" 283 "movl %%ecx, %%eax \n\t" 284 "movl %%edx, %%ecx \n\t" 286 "addl %%ecx, %%eax \n\t" 287 "adcl $0, %%edx \n\t" 291 "g" (l4_scaler_tsc_to_us)
302 "movl %%edx, %%ecx \n\t" 304 "movl %%ecx, %%eax \n\t" 305 "movl %%edx, %%ecx \n\t" 307 "addl %%ecx, %%eax \n\t" 308 "adcl $0, %%edx \n\t" 309 "movl $1000000000, %%ecx \n\t" 310 "shld $5, %%eax, %%edx \n\t" 311 "shll $5, %%eax \n\t" 313 :
"=a" (*s),
"=d" (*ns),
"=&c" (dummy)
314 :
"A" (tsc),
"g" (l4_scaler_tsc_to_ns)
325 "movl %%edx, %%ecx \n\t" 327 "movl %%ecx, %%eax \n\t" 328 "movl %%edx, %%ecx \n\t" 330 "addl %%ecx, %%eax \n\t" 331 "adcl $0, %%edx \n\t" 332 "shld $5, %%eax, %%edx \n\t" 333 "shll $5, %%eax \n\t" 337 "g" (l4_scaler_ns_to_tsc)
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.