x64: Simplify RDTSC on non-MSVC compilers
Co-Authored-By: liamwhite <liamwhite@users.noreply.github.com>
This commit is contained in:
parent
e1bce50d8b
commit
981bc8aa1c
2 changed files with 10 additions and 16 deletions
|
@ -33,16 +33,13 @@ __forceinline static void TPAUSE() {
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static u64 FencedRDTSC() {
|
static u64 FencedRDTSC() {
|
||||||
u64 result;
|
u64 eax;
|
||||||
|
u64 edx;
|
||||||
asm volatile("lfence\n\t"
|
asm volatile("lfence\n\t"
|
||||||
"rdtsc\n\t"
|
"rdtsc\n\t"
|
||||||
"shl $32, %%rdx\n\t"
|
"lfence\n\t"
|
||||||
"or %%rdx, %0\n\t"
|
: "=a"(eax), "=d"(edx));
|
||||||
"lfence"
|
return (edx << 32) | eax;
|
||||||
: "=a"(result)
|
|
||||||
:
|
|
||||||
: "rdx", "memory", "cc");
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void TPAUSE() {
|
static void TPAUSE() {
|
||||||
|
|
|
@ -27,16 +27,13 @@ __forceinline static u64 FencedRDTSC() {
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static u64 FencedRDTSC() {
|
static u64 FencedRDTSC() {
|
||||||
u64 result;
|
u64 eax;
|
||||||
|
u64 edx;
|
||||||
asm volatile("lfence\n\t"
|
asm volatile("lfence\n\t"
|
||||||
"rdtsc\n\t"
|
"rdtsc\n\t"
|
||||||
"shl $32, %%rdx\n\t"
|
"lfence\n\t"
|
||||||
"or %%rdx, %0\n\t"
|
: "=a"(eax), "=d"(edx));
|
||||||
"lfence"
|
return (edx << 32) | eax;
|
||||||
: "=a"(result)
|
|
||||||
:
|
|
||||||
: "rdx", "memory", "cc");
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue