aboutsummaryrefslogtreecommitdiff
path: root/src/util.h
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2012-01-29 13:30:56 -0500
committerKevin O'Connor <kevin@koconnor.net>2012-02-01 20:42:45 -0500
commit9eb210023718c65a1300cb0b768ba478b0a2b211 (patch)
tree52bde0079bae0fc400abe1e1e2a7b5df111a14c9 /src/util.h
parente216ce8fb5470a375756574d65723cbf764a2919 (diff)
downloadseabios-hppa-9eb210023718c65a1300cb0b768ba478b0a2b211.zip
seabios-hppa-9eb210023718c65a1300cb0b768ba478b0a2b211.tar.gz
seabios-hppa-9eb210023718c65a1300cb0b768ba478b0a2b211.tar.bz2
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 <r.marek@assembler.cz> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/util.h')
-rw-r--r--src/util.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/util.h b/src/util.h
index eecba8b..2c5f7eb 100644
--- a/src/util.h
+++ b/src/util.h
@@ -18,15 +18,14 @@ static inline void irq_enable(void)
asm volatile("sti": : :"memory");
}
-static inline unsigned long irq_save(void)
+static inline u32 save_flags(void)
{
- unsigned long flags;
- asm volatile("pushfl ; popl %0" : "=g" (flags): :"memory");
- irq_disable();
+ u32 flags;
+ asm volatile("pushfl ; popl %0" : "=rm" (flags));
return flags;
}
-static inline void irq_restore(unsigned long flags)
+static inline void restore_flags(u32 flags)
{
asm volatile("pushl %0 ; popfl" : : "g" (flags) : "memory", "cc");
}
@@ -54,7 +53,7 @@ static inline void wbinvd(void)
#define CPUID_MSR (1 << 5)
#define CPUID_APIC (1 << 9)
#define CPUID_MTRR (1 << 12)
-static inline void cpuid(u32 index, u32 *eax, u32 *ebx, u32 *ecx, u32 *edx)
+static inline void __cpuid(u32 index, u32 *eax, u32 *ebx, u32 *ecx, u32 *edx)
{
asm("cpuid"
: "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx)
@@ -196,6 +195,7 @@ struct descloc_s {
} PACKED;
// util.c
+void cpuid(u32 index, u32 *eax, u32 *ebx, u32 *ecx, u32 *edx);
struct bregs;
inline void call16(struct bregs *callregs);
inline void call16big(struct bregs *callregs);