Files
mckernel/test/uti/mpi/delay.h
Dominique Martinet 100754f556 test: add uti tests
Change-Id: Ib59f1c4dab7cec7e67ba35ec1988f6f968a2deaa
2019-02-01 15:15:14 +09:00

41 lines
717 B
C

#ifndef __DELAY_H_INCLUDED__
#define __DELAY_H_INCLUDED__
static inline uint64_t rdtsc_light(void)
{
uint64_t x;
/* rdtscp don't jump over earlier instructions */
__asm__ __volatile__("rdtscp;"
"shl $32, %%rdx;"
"or %%rdx, %%rax" :
"=a"(x) :
:
"%rcx", "%rdx", "memory");
return x;
}
static inline void asmloop(unsigned long n)
{
int j;
for (j = 0; j < n; j++) {
asm volatile(
"movq $0, %%rcx\n\t"
"1:\t"
"addq $1, %%rcx\n\t"
"cmpq $99, %%rcx\n\t"
"jle 1b\n\t"
:
:
: "rcx", "cc");
}
}
void ndelay_init(void);
void ndelay(long delay_nsec);
void cdelay_init(void);
void cdelay(long delay_cyc);
#endif