summaryrefslogtreecommitdiff
path: root/payloads/libpayload/include/x86
diff options
context:
space:
mode:
authorSubrata Banik <subratabanik@google.com>2024-07-10 17:29:38 +0000
committerSubrata Banik <subratabanik@google.com>2024-07-11 15:27:30 +0000
commit7f822a3368fcfabc7bb0f316a9eafba5a0604f43 (patch)
tree7b7a5969b1fe8a6e9bb8d5a3d5082e8bd94864eb /payloads/libpayload/include/x86
parente94d29a02bf50c1cc9bd9340375134832d3ad4a2 (diff)
libpayload/x86: Add x86-64 support to rdtsc()
This patch adds support for x86-64 to the rdtsc() function, allowing it to correctly read the Time Stamp Counter (TSC) on both 32-bit and 64-bit x86 architectures. BUG=b:242829490, b:351851626 TEST=Builds and boots on google/rex0 and google/rex64 systems and manually verified correct TSC readings on x86-32 and x86-64 hardware. Change-Id: I0afac3db2e82a245a37c2e5cf2302bf1dad62c01 Signed-off-by: Subrata Banik <subratabanik@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/83414 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'payloads/libpayload/include/x86')
-rw-r--r--payloads/libpayload/include/x86/arch/rdtsc.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/payloads/libpayload/include/x86/arch/rdtsc.h b/payloads/libpayload/include/x86/arch/rdtsc.h
index 41ab24a9c7..2c92a9f4d4 100644
--- a/payloads/libpayload/include/x86/arch/rdtsc.h
+++ b/payloads/libpayload/include/x86/arch/rdtsc.h
@@ -33,9 +33,9 @@
static u64 rdtsc(void)
{
- u64 val;
- __asm__ __volatile__ ("rdtsc" : "=A" (val));
- return val;
+ u32 lo, hi;
+ __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi));
+ return (u64)hi << 32 | lo;
}
#endif