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>
This commit is contained in:
@ -33,9 +33,9 @@
|
|||||||
|
|
||||||
static u64 rdtsc(void)
|
static u64 rdtsc(void)
|
||||||
{
|
{
|
||||||
u64 val;
|
u32 lo, hi;
|
||||||
__asm__ __volatile__ ("rdtsc" : "=A" (val));
|
__asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi));
|
||||||
return val;
|
return (u64)hi << 32 | lo;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user