mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-03 17:58:30 +00:00
Make progress towards aarch64 build
This commit is contained in:
parent
08ff26c817
commit
ca2860947f
15428 changed files with 25694 additions and 23138 deletions
|
@ -32,12 +32,21 @@ COSMOPOLITAN_C_START_
|
|||
#define mfence_lfence_rdtsc_lfence() \
|
||||
__RDTSC("mfence\n\tlfence\n\trdtsc\n\tlfence")
|
||||
|
||||
#ifdef __x86__
|
||||
#define __RDTSC(ASM) \
|
||||
({ \
|
||||
uint64_t Rax, Rdx; \
|
||||
asm volatile(ASM : "=a"(Rax), "=d"(Rdx) : /* no inputs */ : "memory"); \
|
||||
Rdx << 32 | Rax; \
|
||||
})
|
||||
#elif defined(__aarch64__)
|
||||
#define __RDTSC(ASM) \
|
||||
({ \
|
||||
uint64_t _Ts; \
|
||||
asm volatile("mrs\t%0,cntvct_el0" : "=r"(_Ts)); \
|
||||
_Ts * 48; /* the fudge factor */ \
|
||||
})
|
||||
#endif
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue