mirror of
https://github.com/kanjitalk755/macemu.git
synced 2025-01-12 16:30:44 +00:00
fix cpuid test on x86_64 and newer binutils
This commit is contained in:
parent
6774a0821d
commit
9e330d5615
@ -64,8 +64,13 @@ static unsigned int x86_cpuid(void)
|
|||||||
CPUID(0). Preserve %ebx and %ecx; cpuid insn clobbers these, we
|
CPUID(0). Preserve %ebx and %ecx; cpuid insn clobbers these, we
|
||||||
don't need their CPUID values here, and %ebx may be the PIC
|
don't need their CPUID values here, and %ebx may be the PIC
|
||||||
register. */
|
register. */
|
||||||
|
#ifdef __x86_64__
|
||||||
|
__asm__ ("pushq %%rcx; pushq %%rbx; cpuid; popq %%rbx; popq %%rcx"
|
||||||
|
: "=a" (fl1) : "0" (0) : "rdx", "cc");
|
||||||
|
#else
|
||||||
__asm__ ("push %%ecx ; push %%ebx ; cpuid ; pop %%ebx ; pop %%ecx"
|
__asm__ ("push %%ecx ; push %%ebx ; cpuid ; pop %%ebx ; pop %%ecx"
|
||||||
: "=a" (fl1) : "0" (0) : "edx", "cc");
|
: "=a" (fl1) : "0" (0) : "edx", "cc");
|
||||||
|
#endif
|
||||||
if (fl1 == 0)
|
if (fl1 == 0)
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
@ -86,6 +91,18 @@ powerpc_dyngen::powerpc_dyngen(dyngen_cpu_base cpu, int cache_size)
|
|||||||
{
|
{
|
||||||
#if defined(__i386__) || defined(__x86_64__)
|
#if defined(__i386__) || defined(__x86_64__)
|
||||||
cpu_features = x86_cpuid();
|
cpu_features = x86_cpuid();
|
||||||
|
#ifdef SHEEPSHAVER
|
||||||
|
if (cpu_features & (HWCAP_I386_MMX | HWCAP_I386_SSE | HWCAP_I386_SSE2)) {
|
||||||
|
printf("Detected CPU features:");
|
||||||
|
if (cpu_features & HWCAP_I386_MMX)
|
||||||
|
printf(" MMX");
|
||||||
|
if (cpu_features & HWCAP_I386_SSE)
|
||||||
|
printf(" SSE");
|
||||||
|
if (cpu_features & HWCAP_I386_SSE2)
|
||||||
|
printf(" SSE2");
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user