mirror of
https://github.com/kanjitalk755/macemu.git
synced 2025-02-19 19:30:42 +00:00
Allocate executable space to detect cpu features (cpuid). aka don't crash
on non-executable .data sections on x86-64 with NX support enabled.
This commit is contained in:
parent
569d916664
commit
5c001ba645
@ -3671,7 +3671,12 @@ x86_get_cpu_vendor(struct cpuinfo_x86 *c)
|
|||||||
static void
|
static void
|
||||||
cpuid(uae_u32 op, uae_u32 *eax, uae_u32 *ebx, uae_u32 *ecx, uae_u32 *edx)
|
cpuid(uae_u32 op, uae_u32 *eax, uae_u32 *ebx, uae_u32 *ecx, uae_u32 *edx)
|
||||||
{
|
{
|
||||||
static uae_u8 cpuid_space[256];
|
const int CPUID_SPACE = 4096;
|
||||||
|
uae_u8* cpuid_space = (uae_u8 *)vm_acquire(CPUID_SPACE);
|
||||||
|
if (cpuid_space == VM_MAP_FAILED)
|
||||||
|
abort();
|
||||||
|
vm_protect(cpuid_space, CPUID_SPACE, VM_PAGE_READ | VM_PAGE_WRITE | VM_PAGE_EXECUTE);
|
||||||
|
|
||||||
static uae_u32 s_op, s_eax, s_ebx, s_ecx, s_edx;
|
static uae_u32 s_op, s_eax, s_ebx, s_ecx, s_edx;
|
||||||
uae_u8* tmp=get_target();
|
uae_u8* tmp=get_target();
|
||||||
|
|
||||||
@ -3699,6 +3704,8 @@ cpuid(uae_u32 op, uae_u32 *eax, uae_u32 *ebx, uae_u32 *ecx, uae_u32 *edx)
|
|||||||
if (ebx != NULL) *ebx = s_ebx;
|
if (ebx != NULL) *ebx = s_ebx;
|
||||||
if (ecx != NULL) *ecx = s_ecx;
|
if (ecx != NULL) *ecx = s_ecx;
|
||||||
if (edx != NULL) *edx = s_edx;
|
if (edx != NULL) *edx = s_edx;
|
||||||
|
|
||||||
|
vm_release(cpuid_space, CPUID_SPACE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
x
Reference in New Issue
Block a user