summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarren Hart <dvhart@linux.intel.com>2013-08-21 09:31:03 -0700
committerKay Sievers <kay@vrfy.org>2013-08-21 19:01:07 +0200
commit612e086cfc1600f5654b1f472b96ed3bb78bf246 (patch)
tree8b14d845a2a2a126bb5c5b2f54e37d1f9b6f21d8
parent5d85fe49d5f7c5bf4f0bb0485c25f945b3bd6e57 (diff)
gummiboot: Add 32 bit compatible rdtsc asm
Gcc's inline asm constraints have different meanings on x86_64 and ia32. Include a 32 bit version for the rdtsc function. Drop the empty 32 bit version of time_usec as it and the cpuid function both function properly when compiled for 32 bit systems. Tested on the following CPU: Intel(R) Atom(TM) CPU E640 @ 1.00GHz A value of 1000000000 was detected. Signed-off-by: Darren Hart <dvhart@linux.intel.com> Cc: "Ylinen, Mikko" <mikko.ylinen@intel.com>
-rw-r--r--src/efi/gummiboot.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/efi/gummiboot.c b/src/efi/gummiboot.c
index 844ce5f..9f2f31d 100644
--- a/src/efi/gummiboot.c
+++ b/src/efi/gummiboot.c
@@ -90,6 +90,13 @@ static UINT64 ticks_read(void) {
__asm__ volatile ("rdtsc" : "=a" (a), "=d" (d));
return (d << 32) | a;
}
+#else
+static UINT64 ticks_read(void) {
+ UINT64 val;
+ __asm__ volatile ("rdtsc" : "=A" (val));
+ return val;
+}
+#endif
static void cpuid_read(UINT32 info, UINT32 *eax, UINT32 *ebx, UINT32 *ecx, UINT32 *edx) {
*eax = info;
@@ -187,9 +194,6 @@ static UINT64 time_usec(void) {
return 1000 * 1000 * ticks / cpufreq;
}
-#else
-static UINT64 time_usec(void) { return 0; }
-#endif
static EFI_STATUS efivar_set_raw(const EFI_GUID *vendor, CHAR16 *name, CHAR8 *buf, UINTN size, BOOLEAN persistent) {
UINT32 flags;