mirror of
https://github.com/RPCSX/llvm.git
synced 2025-02-07 21:20:18 +00:00
A better workaround
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25692 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
3ea0e0e005
commit
b3a7e21b7e
@ -22,11 +22,10 @@ static void GetCpuIDAndInfo(unsigned value, unsigned *EAX, unsigned *EBX,
|
|||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__)
|
||||||
asm ("pushl\t%%ebx\n\t"
|
asm ("pushl\t%%ebx\n\t"
|
||||||
"cpuid\n\t"
|
"cpuid\n\t"
|
||||||
|
"movl\t%%ebx, %%esi\n\t"
|
||||||
"popl\t%%ebx"
|
"popl\t%%ebx"
|
||||||
: "=a" (*EAX),
|
: "=a" (*EAX),
|
||||||
#if !defined(__DYNAMIC__) // This works around a gcc -fPIC bug
|
"=S" (*EBX),
|
||||||
"=b" (*EBX),
|
|
||||||
#endif
|
|
||||||
"=c" (*ECX),
|
"=c" (*ECX),
|
||||||
"=d" (*EDX)
|
"=d" (*EDX)
|
||||||
: "a" (value));
|
: "a" (value));
|
||||||
@ -35,11 +34,11 @@ static void GetCpuIDAndInfo(unsigned value, unsigned *EAX, unsigned *EBX,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const char *GetCurrentX86CPU() {
|
static const char *GetCurrentX86CPU() {
|
||||||
unsigned EAX = 0, DUMMY = 0, ECX = 0, EDX = 0;
|
unsigned EAX = 0, EBX = 0, ECX = 0, EDX = 0;
|
||||||
GetCpuIDAndInfo(0x1, &EAX, &DUMMY, &ECX, &EDX);
|
GetCpuIDAndInfo(0x1, &EAX, &EBX, &ECX, &EDX);
|
||||||
unsigned Family = (EAX & (0xffffffff >> (32 - 4)) << 8) >> 8; // Bits 8 - 11
|
unsigned Family = (EAX & (0xffffffff >> (32 - 4)) << 8) >> 8; // Bits 8 - 11
|
||||||
unsigned Model = (EAX & (0xffffffff >> (32 - 4)) << 4) >> 4; // Bits 4 - 7
|
unsigned Model = (EAX & (0xffffffff >> (32 - 4)) << 4) >> 4; // Bits 4 - 7
|
||||||
GetCpuIDAndInfo(0x80000001, &EAX, &DUMMY, &ECX, &EDX);
|
GetCpuIDAndInfo(0x80000001, &EAX, &EBX, &ECX, &EDX);
|
||||||
bool Em64T = EDX & (1 << 29);
|
bool Em64T = EDX & (1 << 29);
|
||||||
|
|
||||||
switch (Family) {
|
switch (Family) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user