1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 20:38:08 +01:00

Fixed code for MMX detection to work.

This commit is contained in:
dan
2000-01-20 04:47:03 +00:00
parent 1e5a1d8c91
commit a5cc413432

View File

@@ -31,30 +31,29 @@ x86_check_mmx()
{ {
static int result = -1; static int result = -1;
return 1;
if (result >= 0) if (result >= 0)
return result; return result;
result = 0; result = 0;
asm volatile asm volatile
("pushfl \n" // check whether cpuid supported ("pushal \n" // please don't forget this in any asm
"pushfl \n" // check whether cpuid supported
"pop %%eax \n" "pop %%eax \n"
"movl %%eax, %%ebx \n" "movl %%eax, %%ebx \n"
"xorl 1<<21, %%eax \n" "xorl $(1<<21), %%eax \n"
"pushl %%eax \n" "pushl %%eax \n"
"popfl \n" "popfl \n"
"pushfl \n" "pushfl \n"
"popl %%eax \n" "popl %%eax \n"
"xorl %%eax, %%ebx \n" "xorl %%ebx, %%eax \n"
"andl 1<<21, %%eax \n" "andl $(1<<21), %%eax \n"
"jz .NotPentium \n" "jz .NotPentium \n"
"xorl %%eax, %%eax \n" "xorl %%eax, %%eax \n"
"movl $1, %%eax \n" "movl $1, %%eax \n"
"cpuid \n" "cpuid \n"
"test 1<<23, %%edx \n" "test $(1<<23), %%edx \n"
"jz .NotMMX \n" "jz .NotMMX \n"
"movl $1, %0 \n" "movl $1, %0 \n"
@@ -111,7 +110,7 @@ x86_mmx_TrueColor_32_to_16(unsigned char *image, // 8
( (
"subl $128, %esp \n" // alloc some more stack "subl $128, %esp \n" // alloc some more stack
"pusha \n" "pushal \n"
// pack dr, dg and db into mm6 // pack dr, dg and db into mm6
"movl 36(%ebp), %eax \n" "movl 36(%ebp), %eax \n"
@@ -292,7 +291,7 @@ x86_mmx_TrueColor_32_to_16(unsigned char *image, // 8
"emms \n" "emms \n"
"popa \n" "popal \n"
); );
} }
@@ -380,7 +379,7 @@ x86_PseudoColor_32_to_8(unsigned char *image, // 8
( (
"andl $-8, %ebp \n" "andl $-8, %ebp \n"
"subl $128, %esp \n" // alloc some stack space "subl $128, %esp \n" // alloc some stack space
"pusha \n" "pushal \n"
// process 1 pixel / cycle, each component treated as 16bit // process 1 pixel / cycle, each component treated as 16bit
"movl 8(%ebp), %esi \n" // esi = image->data "movl 8(%ebp), %esi \n" // esi = image->data
@@ -426,7 +425,7 @@ x86_PseudoColor_32_to_8(unsigned char *image, // 8
".Endb: \n" ".Endb: \n"
"popa \n" "popal \n"
); );