summaryrefslogtreecommitdiffstats
path: root/TOOLS/cpuinfo.c
diff options
context:
space:
mode:
Diffstat (limited to 'TOOLS/cpuinfo.c')
-rw-r--r--TOOLS/cpuinfo.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/TOOLS/cpuinfo.c b/TOOLS/cpuinfo.c
index 1bdf2f30e2..f1e8022f9d 100644
--- a/TOOLS/cpuinfo.c
+++ b/TOOLS/cpuinfo.c
@@ -17,6 +17,10 @@ void gettimeofday(struct timeval* t,void* timezone)
#define sleep(t) _sleep(1000*t);
#endif
+#ifdef __BEOS__
+#define usleep(t) snooze(t)
+#endif
+
#ifdef M_UNIX
typedef long long int64_t;
#define MISSING_USLEEP
@@ -36,11 +40,13 @@ static cpuid_regs_t
cpuid(int func) {
cpuid_regs_t regs;
#define CPUID ".byte 0x0f, 0xa2; "
- asm("movl %4,%%eax; " CPUID
- "movl %%eax,%0; movl %%ebx,%1; movl %%ecx,%2; movl %%edx,%3"
+ asm("push %%ebx; "
+ "movl %4,%%eax; " CPUID
+ "movl %%eax,%0; movl %%ebx,%1; movl %%ecx,%2; movl %%edx,%3; "
+ "pop %%ebx"
: "=m" (regs.eax), "=m" (regs.ebx), "=m" (regs.ecx), "=m" (regs.edx)
: "g" (func)
- : "%eax", "%ebx", "%ecx", "%edx");
+ : "%eax", "%ecx", "%edx");
return regs;
}