summaryrefslogtreecommitdiff
path: root/target-ppc/mmu_helper.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2013-03-13 11:40:33 +1100
committerAlexander Graf <agraf@suse.de>2013-03-22 15:28:53 +0100
commitb632a148b677b773ff155f9de840b37a653567b9 (patch)
treeaab465efcff6575e29d7505ef15b485a45fa8836 /target-ppc/mmu_helper.c
parenteb20c1c6da60c8c75f08def03b0822a48af620ac (diff)
downloadqemu-b632a148b677b773ff155f9de840b37a653567b9.tar.gz
target-ppc: Use QOM method dispatch for MMU fault handling
After previous cleanups, the many scattered checks of env->mmu_model in the ppc MMU implementation have, at least for "classic" hash MMUs been reduced (almost) to a single switch at the top of cpu_ppc_handle_mmu_fault(). An explicit switch is still a pretty ugly way of handling this though. Now that Andreas Färber's CPU QOM cleanups for ppc have gone in, it's quite straightforward to instead make the handle_mmu_fault function a QOM method on the CPU object. This patch implements such a scheme, initializing the method pointer at the same time as the mmu_model variable. We need to keep the latter around for now, because of the MMU types (BookE, 4xx, et al) which haven't been converted to the new scheme yet, and also for a few other uses. It would be good to clean those up eventually. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'target-ppc/mmu_helper.c')
-rw-r--r--target-ppc/mmu_helper.c24
1 files changed, 7 insertions, 17 deletions
diff --git a/target-ppc/mmu_helper.c b/target-ppc/mmu_helper.c
index 4c41673383..acf01331f1 100644
--- a/target-ppc/mmu_helper.c
+++ b/target-ppc/mmu_helper.c
@@ -1391,22 +1391,6 @@ static int cpu_ppc_handle_mmu_fault(CPUPPCState *env, target_ulong address,
int access_type;
int ret = 0;
- switch (env->mmu_model) {
-#if defined(TARGET_PPC64)
- case POWERPC_MMU_64B:
- case POWERPC_MMU_2_06:
- case POWERPC_MMU_2_06d:
- return ppc_hash64_handle_mmu_fault(env, address, rw, mmu_idx);
-#endif
-
- case POWERPC_MMU_32B:
- case POWERPC_MMU_601:
- return ppc_hash32_handle_mmu_fault(env, address, rw, mmu_idx);
-
- default:
- ; /* Otherwise fall through to the general code below */
- }
-
if (rw == 2) {
/* code access */
rw = 0;
@@ -2802,9 +2786,15 @@ void helper_booke206_tlbflush(CPUPPCState *env, uint32_t type)
void tlb_fill(CPUPPCState *env, target_ulong addr, int is_write, int mmu_idx,
uintptr_t retaddr)
{
+ CPUState *cpu = ENV_GET_CPU(env);
+ PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu);
int ret;
- ret = cpu_ppc_handle_mmu_fault(env, addr, is_write, mmu_idx);
+ if (pcc->handle_mmu_fault) {
+ ret = pcc->handle_mmu_fault(env, addr, is_write, mmu_idx);
+ } else {
+ ret = cpu_ppc_handle_mmu_fault(env, addr, is_write, mmu_idx);
+ }
if (unlikely(ret != 0)) {
if (likely(retaddr)) {
/* now we have a real cpu fault */