summaryrefslogtreecommitdiff
path: root/cputlb.c
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2013-05-27 06:49:53 +0200
committerAndreas Färber <afaerber@suse.de>2013-06-28 13:25:13 +0200
commitc658b94f6e8c206c59d02aa6fbac285b86b53d2c (patch)
tree100efd8e543a576daa8d7dc6684ce1154ea08245 /cputlb.c
parentce927ed9e40e25008453eb8f130661514b633341 (diff)
downloadqemu-c658b94f6e8c206c59d02aa6fbac285b86b53d2c.tar.gz
qemu-c658b94f6e8c206c59d02aa6fbac285b86b53d2c.tar.bz2
qemu-c658b94f6e8c206c59d02aa6fbac285b86b53d2c.zip
cpu: Turn cpu_unassigned_access() into a CPUState hook
Use it for all targets, but be careful not to pass invalid CPUState. cpu_single_env can be NULL, e.g. on Xen. Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'cputlb.c')
-rw-r--r--cputlb.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/cputlb.c b/cputlb.c
index 947f17cd11..80b2a94ade 100644
--- a/cputlb.c
+++ b/cputlb.c
@@ -331,12 +331,15 @@ tb_page_addr_t get_page_addr_code(CPUArchState *env1, target_ulong addr)
pd = env1->iotlb[mmu_idx][page_index] & ~TARGET_PAGE_MASK;
mr = iotlb_to_region(pd);
if (memory_region_is_unassigned(mr)) {
-#if defined(TARGET_ALPHA) || defined(TARGET_MIPS) || defined(TARGET_SPARC)
- cpu_unassigned_access(env1, addr, 0, 1, 0, 4);
-#else
- cpu_abort(env1, "Trying to execute code outside RAM or ROM at 0x"
- TARGET_FMT_lx "\n", addr);
-#endif
+ CPUState *cpu = ENV_GET_CPU(env1);
+ CPUClass *cc = CPU_GET_CLASS(cpu);
+
+ if (cc->do_unassigned_access) {
+ cc->do_unassigned_access(cpu, addr, false, true, 0, 4);
+ } else {
+ cpu_abort(env1, "Trying to execute code outside RAM or ROM at 0x"
+ TARGET_FMT_lx "\n", addr);
+ }
}
p = (void *)((uintptr_t)addr + env1->tlb_table[mmu_idx][page_index].addend);
return qemu_ram_addr_from_host_nofail(p);