From: Kevin O'Connor Date: Sun, 29 Jan 2012 18:30:56 +0000 (-0500) Subject: Detect CPUID instruction before using it. X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=seabios.git;a=commitdiff_plain;h=9eb210023718c65a1300cb0b768ba478b0a2b211 Detect CPUID instruction before using it. Enable SeaBIOS to work on 386/486 machines that don't have CPUID instruction. Based on patch by Rudolf Marek. Signed-off-by: Rudolf Marek Signed-off-by: Kevin O'Connor --- diff --git a/src/bregs.h b/src/bregs.h index f026fa8..577effc 100644 --- a/src/bregs.h +++ b/src/bregs.h @@ -11,6 +11,7 @@ #define F_CF (1<<0) #define F_ZF (1<<6) #define F_IF (1<<9) +#define F_ID (1<<21) // CR0 flags #define CR0_PG (1<<31) // Paging diff --git a/src/mtrr.c b/src/mtrr.c index 0548043..ec3be4f 100644 --- a/src/mtrr.c +++ b/src/mtrr.c @@ -84,9 +84,9 @@ void mtrr_setup(void) int phys_bits = 36; cpuid(0x80000000u, &eax, &ebx, &ecx, &edx); if (eax >= 0x80000008) { - /* Get physical bits from leaf 0x80000008 (if available) */ - cpuid(0x80000008u, &eax, &ebx, &ecx, &edx); - phys_bits = eax & 0xff; + /* Get physical bits from leaf 0x80000008 (if available) */ + cpuid(0x80000008u, &eax, &ebx, &ecx, &edx); + phys_bits = eax & 0xff; } u64 phys_mask = ((1ull << phys_bits) - 1); for (i=0; i