[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC 3/3] exec: Allow to change Address Space from board le
From: |
marcin.krzeminski |
Subject: |
[Qemu-devel] [RFC 3/3] exec: Allow to change Address Space from board level |
Date: |
Fri, 16 Dec 2016 14:22:39 +0100 |
From: Marcin Krzeminski <address@hidden>
By introduction of CPUAddressSpace table it is not possible
to change address space for CPU from board code. In my case
Cortex-M3 core has it own address space that is created at board
level, then updated by changing cpu->as. For current code cpu->as
is used only at init, so changing it does not change actual
address space.
Signed-off-by: Marcin Krzeminski <address@hidden>
---
exec.c | 8 ++++++++
include/qom/cpu.h | 1 +
2 files changed, 9 insertions(+)
diff --git a/exec.c b/exec.c
index 08c558e..9c6e302 100644
--- a/exec.c
+++ b/exec.c
@@ -628,6 +628,14 @@ AddressSpace *cpu_get_address_space(CPUState *cpu, int
asidx)
/* Return the AddressSpace corresponding to the specified index */
return cpu->cpu_ases[asidx].as;
}
+
+void cpu_set_address_space(CPUState *cpu, AddressSpace *as, int asidx)
+{
+ /* Return the AddressSpace corresponding to the specified index */
+ if (asidx < cpu->num_ases) {
+ cpu->cpu_ases[asidx].as = as;
+ }
+}
#endif
void cpu_exec_unrealizefn(CPUState *cpu)
diff --git a/include/qom/cpu.h b/include/qom/cpu.h
index 3f79a8e..7e2ead8 100644
--- a/include/qom/cpu.h
+++ b/include/qom/cpu.h
@@ -964,6 +964,7 @@ void cpu_watchpoint_remove_all(CPUState *cpu, int mask);
* specifies which address space to read.
*/
AddressSpace *cpu_get_address_space(CPUState *cpu, int asidx);
+void cpu_set_address_space(CPUState *cpu, AddressSpace *as, int asidx);
void QEMU_NORETURN cpu_abort(CPUState *cpu, const char *fmt, ...)
GCC_FMT_ATTR(2, 3);
--
2.7.4