[Rawstudio-commit] r2076 - trunk/src
Anders Brander
anders at brander.dk
Tue Oct 21 21:08:58 CEST 2008
Author: abrander
Date: 2008-10-21 21:08:57 +0200 (Tue, 21 Oct 2008)
New Revision: 2076
Modified:
trunk/src/arch-x86.c
Log:
Fixed ebx usage mainly for OSX (Patch by "Pi").
Modified: trunk/src/arch-x86.c
===================================================================
--- trunk/src/arch-x86.c 2008-10-16 21:10:39 UTC (rev 2075)
+++ trunk/src/arch-x86.c 2008-10-21 19:08:57 UTC (rev 2076)
@@ -91,12 +91,14 @@
* Function definitions
*****************************************************************************/
-#define cpuid(cmd, eax, ebx, ecx, edx) \
+#define cpuid(cmd, eax, edx) \
do { \
- eax = ebx = ecx = edx = 0; \
+ eax = edx = 0; \
asm ( \
- "cpuid" \
- : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx) \
+ "pushl %%ebx\n\t"\
+ "cpuid\n\t" \
+ "popl %%ebx\n\t" \
+ : "=a" (eax), "=d" (edx) \
: "0" (cmd) \
); \
} while(0)
@@ -105,13 +107,12 @@
rs_detect_cpu_features()
{
guint eax;
- guint ebx;
- guint ecx;
guint edx;
guint cpuflags = 0;
/* Test cpuid presence comparing eflags */
asm (
+ "pushl %%"REG_b"\n\t"
"pushf\n\t"
"pop %%"REG_a"\n\t"
"mov %%"REG_a", %%"REG_b"\n\t"
@@ -124,9 +125,10 @@
"je notfound\n\t"
"mov $1, %0\n\t"
"notfound:\n\t"
+ "popl %%"REG_b"\n\t"
: "=r" (eax)
:
- : REG_a, REG_b
+ : REG_a
);
@@ -136,12 +138,12 @@
guint ext_dsc;
/* Get the standard level */
- cpuid(0x00000000, std_dsc, ebx, ecx, edx);
+ cpuid(0x00000000, std_dsc, edx);
if (std_dsc)
{
/* Request for standard features */
- cpuid(0x00000001, std_dsc, ebx, ecx, edx);
+ cpuid(0x00000001, std_dsc, edx);
if (edx & 0x00800000)
cpuflags |= _MMX;
@@ -152,12 +154,12 @@
}
/* Is there extensions */
- cpuid(0x80000000, ext_dsc, ebx, ecx, edx);
+ cpuid(0x80000000, ext_dsc, edx);
if (ext_dsc)
{
/* Request for extensions */
- cpuid(0x80000001, eax, ebx, ecx, edx);
+ cpuid(0x80000001, eax, edx);
if (edx & 0x80000000)
cpuflags |= _3DNOW;
More information about the Rawstudio-commit
mailing list