- Add an alternate PIC-compliant __cpuid macro in x86.cpp.

SVN r1793 (trunk)
This commit is contained in:
Randy Heit 2009-09-04 23:14:29 +00:00
parent 6214177f1f
commit b528b987da
2 changed files with 12 additions and 0 deletions

View file

@ -2,6 +2,7 @@ September 5, 2009 (Changes by Graf Zahl)
- made menu dimming a mapping option but kept the CVARS as user override. - made menu dimming a mapping option but kept the CVARS as user override.
September 4, 2009 September 4, 2009
- Add an alternate PIC-compliant __cpuid macro in x86.cpp.
- Fixed: S_LoadSound() did not byte-swap the frequency and length it reads - Fixed: S_LoadSound() did not byte-swap the frequency and length it reads
from DMX sounds. from DMX sounds.
- Fixed: PNGTexture must not use the FArchive >> operator as a short hand - Fixed: PNGTexture must not use the FArchive >> operator as a short hand

View file

@ -25,10 +25,21 @@ void DumpCPUInfo(const CPUInfo *cpu)
#include <mmintrin.h> #include <mmintrin.h>
#include <emmintrin.h> #include <emmintrin.h>
#ifdef __GNUC__ #ifdef __GNUC__
#if defined(__i386__) && defined(__PIC__)
// %ebx may by the PIC register. */
#define __cpuid(output, func) \
__asm__ __volatile__("xchgl\t%%ebx, %1\n\t" \
"cpuid\n\t" \
"xchgl\t%%ebx, %1\n\t" \
: "=a" ((output)[0]), "=r" ((output)[1]), "=c" ((output)[2]), "=d" ((output)[3]) \
: "a" (func));
#else
#define __cpuid(output, func) __asm__ __volatile__("cpuid" : "=a" ((output)[0]),\ #define __cpuid(output, func) __asm__ __volatile__("cpuid" : "=a" ((output)[0]),\
"=b" ((output)[1]), "=c" ((output)[2]), "=d" ((output)[3]) : "a" (func)); "=b" ((output)[1]), "=c" ((output)[2]), "=d" ((output)[3]) : "a" (func));
#endif #endif
#endif
void CheckCPUID(CPUInfo *cpu) void CheckCPUID(CPUInfo *cpu)
{ {