From 910bd84cf81f5a0bfe016d5b54a911f580a0407e Mon Sep 17 00:00:00 2001 From: guillemj <> Date: Sat, 2 Sep 2006 03:12:29 +0000 Subject: [PATCH] Backport glide3 fix for PIC compilation with gcc 4.1 from Hans de Goede. --- glide2x/cvg/glide/src/cpuid.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/glide2x/cvg/glide/src/cpuid.c b/glide2x/cvg/glide/src/cpuid.c index 3fbed94..db26c64 100644 --- a/glide2x/cvg/glide/src/cpuid.c +++ b/glide2x/cvg/glide/src/cpuid.c @@ -3,6 +3,9 @@ * * $Header$ * $Log$ + * Revision 1.1.2.1 2004/12/12 15:16:02 koolsmoky + * new cpuid + * * Revision 1.1.2.10 2004/10/05 14:54:29 dborca * DOS/OpenWatcom woes * @@ -61,7 +64,7 @@ typedef unsigned long word32; * TEST_MMXPLUS = emms | pminsw mm0, mm0 | emms */ #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_SSE2() __asm __volatile (".byte 0x66, 0x0f, 0x57, 0xc0") #define TEST_3DNOW() __asm __volatile (".byte 0x0f, 0x0e") @@ -200,31 +203,38 @@ int _cpuid (_p_info *pinfo) #ifdef __GNUC__ __asm("\n\ - pushl %%ebx \n\ /* get the vendor string */ \n\ + pushl %%ebx \n\ xorl %%eax, %%eax \n\ cpuid \n\ - movl %%ebx, %3 \n\ + movl %%ebx, %%eax \n\ + popl %%ebx \n\ + movl %%eax, %3 \n\ movl %%edx, %4 \n\ movl %%ecx, %5 \n\ /* get the Standard bits */ \n\ + pushl %%ebx \n\ movl $1, %%eax \n\ cpuid \n\ + popl %%ebx \n\ movl %%eax, %1 \n\ movl %%edx, %2 \n\ /* get AMD-specials */ \n\ + pushl %%ebx \n\ movl $0x80000000, %%eax \n\ cpuid \n\ + popl %%ebx \n\ cmpl $0x80000000, %%eax \n\ jc 0f \n\ + pushl %%ebx \n\ movl $0x80000001, %%eax \n\ cpuid \n\ + popl %%ebx \n\ movl %%edx, %0 \n\ 0: \n\ - popl %%ebx \n\ ":"=g"(dwExt), "=g"(dwId), "=g"(dwFeature), "=g"(((long *)Ident)[0]), "=g"(((long *)Ident)[1]), "=g"(((long *)Ident)[2]) - ::"%eax", "%ebx", "%ecx", "%edx"); + ::"%eax", "%ecx", "%edx"); #else _asm {