bootloader/x86: fix rdtsc for x86_64

should fix regression after hrev57346, see #18647
explained in details at https://gcc.gnu.org/onlinedocs/gcc/Machine-Constraints.html

Change-Id: Ic471c594b87da0bcee346db4a2f78ee1e1d59fe9
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7093
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
Jérôme Duval 2023-11-03 17:17:00 +01:00 committed by waddlesplash
parent 6f58244192
commit dd8a03b78d

View File

@ -23,6 +23,8 @@
#include <string.h>
#include <x86intrin.h>
uint32 gTimeConversionFactor;
@ -174,16 +176,12 @@ private:
static inline uint64_t
rdtsc_fenced()
{
uint64 tsc;
// RDTSC is not serializing, nor does it drain the instruction stream.
// RDTSCP does, but is not available everywhere. Other OSes seem to use
// "CPUID" rather than MFENCE/LFENCE for serializing here during boot.
asm volatile ("cpuid" : : : "eax", "ebx", "ecx", "edx");
asm volatile ("rdtsc" : "=A"(tsc));
return tsc;
return __rdtsc();
}