fix compilation
This commit is contained in:
parent
66bc36473c
commit
778a2703b2
92
fb/fbmmx.c
92
fb/fbmmx.c
|
@ -2300,46 +2300,46 @@ enum CPUFeatures {
|
||||||
CMOV = 0x10
|
CMOV = 0x10
|
||||||
};
|
};
|
||||||
|
|
||||||
static uint detectCPUFeatures(void) {
|
static unsigned int detectCPUFeatures(void) {
|
||||||
uint result;
|
unsigned int result;
|
||||||
char vendor[13];
|
char vendor[13];
|
||||||
vendor[0] = 0;
|
vendor[0] = 0;
|
||||||
vendor[12] = 0;
|
vendor[12] = 0;
|
||||||
/* see p. 118 of amd64 instruction set manual Vol3 */
|
/* see p. 118 of amd64 instruction set manual Vol3 */
|
||||||
asm ("push %%ebx\n"
|
__asm__ ("push %%ebx\n"
|
||||||
"pushf\n"
|
"pushf\n"
|
||||||
"pop %%eax\n"
|
"pop %%eax\n"
|
||||||
"mov %%eax, %%ebx\n"
|
"mov %%eax, %%ebx\n"
|
||||||
"xor $0x00200000, %%eax\n"
|
"xor $0x00200000, %%eax\n"
|
||||||
"push %%eax\n"
|
"push %%eax\n"
|
||||||
"popf\n"
|
"popf\n"
|
||||||
"pushf\n"
|
"pushf\n"
|
||||||
"pop %%eax\n"
|
"pop %%eax\n"
|
||||||
"mov $0x0, %%edx\n"
|
"mov $0x0, %%edx\n"
|
||||||
"xor %%ebx, %%eax\n"
|
"xor %%ebx, %%eax\n"
|
||||||
"jz skip\n"
|
"jz skip\n"
|
||||||
|
|
||||||
"mov $0x00000000, %%eax\n"
|
"mov $0x00000000, %%eax\n"
|
||||||
"cpuid\n"
|
"cpuid\n"
|
||||||
"mov %%ebx, %1\n"
|
"mov %%ebx, %1\n"
|
||||||
"mov %%edx, %2\n"
|
"mov %%edx, %2\n"
|
||||||
"mov %%ecx, %3\n"
|
"mov %%ecx, %3\n"
|
||||||
"mov $0x00000001, %%eax\n"
|
"mov $0x00000001, %%eax\n"
|
||||||
"cpuid\n"
|
"cpuid\n"
|
||||||
"skip:\n"
|
"skip:\n"
|
||||||
"pop %%ebx\n"
|
"pop %%ebx\n"
|
||||||
"mov %%edx, %0\n"
|
"mov %%edx, %0\n"
|
||||||
: "=r" (result),
|
: "=r" (result),
|
||||||
"=m" (vendor[0]),
|
"=m" (vendor[0]),
|
||||||
"=m" (vendor[4]),
|
"=m" (vendor[4]),
|
||||||
"=m" (vendor[8])
|
"=m" (vendor[8])
|
||||||
:
|
:
|
||||||
: "%eax", "%ebx", "%ecx", "%edx"
|
: "%eax", "%ebx", "%ecx", "%edx"
|
||||||
);
|
);
|
||||||
|
|
||||||
uint features = 0;
|
unsigned int features = 0;
|
||||||
if (result) {
|
if (result) {
|
||||||
// result now contains the standard feature bits
|
/* result now contains the standard feature bits */
|
||||||
if (result & (1 << 15))
|
if (result & (1 << 15))
|
||||||
features |= CMOV;
|
features |= CMOV;
|
||||||
if (result & (1 << 23))
|
if (result & (1 << 23))
|
||||||
|
@ -2351,19 +2351,19 @@ static uint detectCPUFeatures(void) {
|
||||||
if ((result & MMX) && !(result & SSE) && (strcmp(vendor, "AuthenticAMD") == 0)) {
|
if ((result & MMX) && !(result & SSE) && (strcmp(vendor, "AuthenticAMD") == 0)) {
|
||||||
/* check for AMD MMX extensions */
|
/* check for AMD MMX extensions */
|
||||||
|
|
||||||
uint result;
|
unsigned int result;
|
||||||
asm("mov $0x80000000, %%eax\n"
|
__asm__("mov $0x80000000, %%eax\n"
|
||||||
"cpuid\n"
|
"cpuid\n"
|
||||||
"xor %%edx, %%edx\n"
|
"xor %%edx, %%edx\n"
|
||||||
"cmp $0x1, %%eax\n"
|
"cmp $0x1, %%eax\n"
|
||||||
"jge skip2\n"
|
"jge skip2\n"
|
||||||
"mov $0x80000001, %%eax\n"
|
"mov $0x80000001, %%eax\n"
|
||||||
"cpuid\n"
|
"cpuid\n"
|
||||||
"skip2:\n"
|
"skip2:\n"
|
||||||
"mov %%edx, %0\n"
|
"mov %%edx, %0\n"
|
||||||
: "=r" (result)
|
: "=r" (result)
|
||||||
:
|
:
|
||||||
: "%eax", "%ebx", "%ecx", "%edx"
|
: "%eax", "%ebx", "%ecx", "%edx"
|
||||||
);
|
);
|
||||||
if (result & (1<<22))
|
if (result & (1<<22))
|
||||||
features |= MMX_Extensions;
|
features |= MMX_Extensions;
|
||||||
|
@ -2380,7 +2380,7 @@ fbHaveMMX (void)
|
||||||
|
|
||||||
if (!initialized)
|
if (!initialized)
|
||||||
{
|
{
|
||||||
uint features = detectCPUFeatures();
|
unsigned int features = detectCPUFeatures();
|
||||||
mmx_present = (features & (MMX|MMX_Extensions)) == (MMX|MMX_Extensions);
|
mmx_present = (features & (MMX|MMX_Extensions)) == (MMX|MMX_Extensions);
|
||||||
initialized = TRUE;
|
initialized = TRUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue