qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v1 6/6] cpu: Delay address space init until realize


From: Peter Crosthwaite
Subject: [Qemu-devel] [PATCH v1 6/6] cpu: Delay address space init until realize
Date: Mon, 25 Aug 2014 17:59:51 -0700

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

Signed-off-by: Peter Crosthwaite <address@hidden>
---

 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

[Prev in Thread] Current Thread [Next in Thread]