gcc4 cpuid fix
This commit is contained in:
@@ -3,6 +3,9 @@
|
|||||||
*
|
*
|
||||||
* $Header$
|
* $Header$
|
||||||
* $Log$
|
* $Log$
|
||||||
|
* Revision 1.1.2.10 2004/10/05 14:54:29 dborca
|
||||||
|
* DOS/OpenWatcom woes
|
||||||
|
*
|
||||||
* Revision 1.1.2.9 2003/08/04 12:45:47 dborca
|
* Revision 1.1.2.9 2003/08/04 12:45:47 dborca
|
||||||
* Preparing for MinGW 2.0
|
* Preparing for MinGW 2.0
|
||||||
*
|
*
|
||||||
@@ -58,7 +61,7 @@ typedef unsigned long word32;
|
|||||||
* TEST_MMXPLUS = emms | pminsw mm0, mm0 | emms
|
* TEST_MMXPLUS = emms | pminsw mm0, mm0 | emms
|
||||||
*/
|
*/
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
#define TEST_CPUID(f) __asm __volatile ("cpuid"::"a"(f):"%ebx", "%ecx", "%edx")
|
#define TEST_CPUID(f) __asm __volatile ("pushl %%ebx; cpuid; popl %%ebx"::"a"(f):"%ecx", "%edx")
|
||||||
#define TEST_SSE() __asm __volatile (".byte 0x0f, 0x57, 0xc0")
|
#define TEST_SSE() __asm __volatile (".byte 0x0f, 0x57, 0xc0")
|
||||||
#define TEST_SSE2() __asm __volatile (".byte 0x66, 0x0f, 0x57, 0xc0")
|
#define TEST_SSE2() __asm __volatile (".byte 0x66, 0x0f, 0x57, 0xc0")
|
||||||
#define TEST_3DNOW() __asm __volatile (".byte 0x0f, 0x0e")
|
#define TEST_3DNOW() __asm __volatile (".byte 0x0f, 0x0e")
|
||||||
@@ -197,31 +200,38 @@ int _cpuid (_p_info *pinfo)
|
|||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
__asm("\n\
|
__asm("\n\
|
||||||
pushl %%ebx \n\
|
|
||||||
/* get the vendor string */ \n\
|
/* get the vendor string */ \n\
|
||||||
|
pushl %%ebx \n\
|
||||||
xorl %%eax, %%eax \n\
|
xorl %%eax, %%eax \n\
|
||||||
cpuid \n\
|
cpuid \n\
|
||||||
movl %%ebx, %3 \n\
|
movl %%ebx, %%eax \n\
|
||||||
|
popl %%ebx \n\
|
||||||
|
movl %%eax, %3 \n\
|
||||||
movl %%edx, %4 \n\
|
movl %%edx, %4 \n\
|
||||||
movl %%ecx, %5 \n\
|
movl %%ecx, %5 \n\
|
||||||
/* get the Standard bits */ \n\
|
/* get the Standard bits */ \n\
|
||||||
|
pushl %%ebx \n\
|
||||||
movl $1, %%eax \n\
|
movl $1, %%eax \n\
|
||||||
cpuid \n\
|
cpuid \n\
|
||||||
|
popl %%ebx \n\
|
||||||
movl %%eax, %1 \n\
|
movl %%eax, %1 \n\
|
||||||
movl %%edx, %2 \n\
|
movl %%edx, %2 \n\
|
||||||
/* get AMD-specials */ \n\
|
/* get AMD-specials */ \n\
|
||||||
|
pushl %%ebx \n\
|
||||||
movl $0x80000000, %%eax \n\
|
movl $0x80000000, %%eax \n\
|
||||||
cpuid \n\
|
cpuid \n\
|
||||||
|
popl %%ebx \n\
|
||||||
cmpl $0x80000000, %%eax \n\
|
cmpl $0x80000000, %%eax \n\
|
||||||
jc 0f \n\
|
jc 0f \n\
|
||||||
|
pushl %%ebx \n\
|
||||||
movl $0x80000001, %%eax \n\
|
movl $0x80000001, %%eax \n\
|
||||||
cpuid \n\
|
cpuid \n\
|
||||||
|
popl %%ebx \n\
|
||||||
movl %%edx, %0 \n\
|
movl %%edx, %0 \n\
|
||||||
0: \n\
|
0: \n\
|
||||||
popl %%ebx \n\
|
|
||||||
":"=g"(dwExt), "=g"(dwId), "=g"(dwFeature),
|
":"=g"(dwExt), "=g"(dwId), "=g"(dwFeature),
|
||||||
"=g"(((long *)Ident)[0]), "=g"(((long *)Ident)[1]), "=g"(((long *)Ident)[2])
|
"=g"(((long *)Ident)[0]), "=g"(((long *)Ident)[1]), "=g"(((long *)Ident)[2])
|
||||||
::"%eax", "%ebx", "%ecx", "%edx");
|
::"%eax", "%ecx", "%edx");
|
||||||
#else
|
#else
|
||||||
_asm
|
_asm
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user