To allow it to be set by the user after init.

Signed-off-by: Peter Crosthwaite <peter.crosthwa...@xilinx.com>
---

 exec.c    | 1 -
 qom/cpu.c | 5 +++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/exec.c b/exec.c
index 5f9857c..15ae6b7 100644
--- a/exec.c
+++ b/exec.c
@@ -492,7 +492,6 @@ void cpu_exec_init(CPUArchState *env)
     QTAILQ_INIT(&cpu->breakpoints);
     QTAILQ_INIT(&cpu->watchpoints);
 #ifndef CONFIG_USER_ONLY
-    cpu->as = &address_space_memory;
     cpu->thread_id = qemu_get_thread_id();
 #endif
     QTAILQ_INSERT_TAIL(&cpus, cpu, node);
diff --git a/qom/cpu.c b/qom/cpu.c
index 899071e..f866d30 100644
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -305,6 +305,11 @@ static void cpu_common_realizefn(DeviceState *dev, Error 
**errp)
 {
     CPUState *cpu = CPU(dev);
 
+#ifndef CONFIG_USER_ONLY
+    cpu->as = cpu->mr ? address_space_init_shareable(cpu->mr, NULL)
+                      : &address_space_memory;
+#endif
+
     if (dev->hotplugged) {
         cpu_synchronize_post_init(cpu);
         notifier_list_notify(&cpu_added_notifiers, dev);
-- 
2.1.0.1.g27b9230


Reply via email to