From dd8a03b78da057c78734e4d34c360f8ef4cab73d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Fri, 3 Nov 2023 17:17:00 +0100 Subject: [PATCH] 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 --- src/system/boot/arch/x86/arch_cpu.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/system/boot/arch/x86/arch_cpu.cpp b/src/system/boot/arch/x86/arch_cpu.cpp index 1f83afb36c..1d20e05ed4 100644 --- a/src/system/boot/arch/x86/arch_cpu.cpp +++ b/src/system/boot/arch/x86/arch_cpu.cpp @@ -23,6 +23,8 @@ #include +#include + 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(); }