[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v1 5/6] qom/cpu: Add Memory Region Property
From: |
Peter Crosthwaite |
Subject: |
[Qemu-devel] [PATCH v1 5/6] qom/cpu: Add Memory Region Property |
Date: |
Mon, 25 Aug 2014 17:59:16 -0700 |
Which is used to construct a per-CPU address space. The Address space
will be created at realize time.
Signed-off-by: Peter Crosthwaite <address@hidden>
---
include/qom/cpu.h | 1 +
qom/cpu.c | 11 +++++++++++
2 files changed, 12 insertions(+)
diff --git a/include/qom/cpu.h b/include/qom/cpu.h
index 1aafbf5..192d337 100644
--- a/include/qom/cpu.h
+++ b/include/qom/cpu.h
@@ -242,6 +242,7 @@ struct CPUState {
int64_t icount_extra;
sigjmp_buf jmp_env;
+ MemoryRegion *mr;
AddressSpace *as;
MemoryListener *tcg_as_listener;
diff --git a/qom/cpu.c b/qom/cpu.c
index b32dd0a..899071e 100644
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -25,6 +25,10 @@
#include "qemu/log.h"
#include "qemu/error-report.h"
#include "sysemu/sysemu.h"
+#include "exec/memory.h"
+#include "qapi/visitor.h"
+#include "exec/address-spaces.h"
+#include "hw/qdev-properties.h"
bool cpu_exists(int64_t id)
{
@@ -314,6 +318,13 @@ static void cpu_common_initfn(Object *obj)
CPUClass *cc = CPU_GET_CLASS(obj);
cpu->gdb_num_regs = cpu->gdb_num_g_regs = cc->gdb_num_core_regs;
+#ifndef CONFIG_USER_ONLY
+ object_property_add_link(obj, "mr", TYPE_MEMORY_REGION,
+ (Object **)&cpu->mr,
+ qdev_prop_allow_set_link_before_realize,
+ OBJ_PROP_LINK_UNREF_ON_RELEASE,
+ &error_abort);
+#endif
}
static int64_t cpu_common_get_arch_id(CPUState *cpu)
--
2.1.0.1.g27b9230