mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-01-11 02:15:37 +00:00
target-i386: create a separate AddressSpace for each CPU
Different CPUs can be in SMM or not at the same time, thus they will see different things where the chipset places SMRAM. Backports commit 2001d0cd6d55e5efa9956fa8ff8b89034d6a4329 from qemu
This commit is contained in:
parent
fa57438734
commit
91503663e2
|
@ -110,6 +110,7 @@ typedef struct X86CPU {
|
|||
/* in order to simplify APIC support, we leave this pointer to the
|
||||
user */
|
||||
struct DeviceState *apic_state;
|
||||
struct MemoryRegion *cpu_as_root;
|
||||
} X86CPU;
|
||||
|
||||
static inline X86CPU *x86_env_get_cpu(CPUX86State *env)
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "sysemu/sysemu.h"
|
||||
#include "hw/cpu/icc_bus.h"
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
#include "exec/address-spaces.h"
|
||||
#include "hw/i386/apic_internal.h"
|
||||
#endif
|
||||
|
||||
|
@ -2368,6 +2369,18 @@ static int x86_cpu_realizefn(struct uc_struct *uc, DeviceState *dev, Error **err
|
|||
#endif
|
||||
|
||||
mce_init(cpu);
|
||||
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
if (tcg_enabled(uc)) {
|
||||
cpu->cpu_as_root = g_new(MemoryRegion, 1);
|
||||
cs->as = g_new(AddressSpace, 1);
|
||||
memory_region_init_alias(uc, cpu->cpu_as_root, OBJECT(cpu), "memory",
|
||||
get_system_memory(uc), 0, ~0ull);
|
||||
memory_region_set_enabled(cpu->cpu_as_root, true);
|
||||
address_space_init(uc, cs->as, cpu->cpu_as_root, "CPU");
|
||||
}
|
||||
#endif
|
||||
|
||||
if (qemu_init_vcpu(cs))
|
||||
return -1;
|
||||
|
||||
|
|
Loading…
Reference in a new issue