diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2013-03-12 00:31:45 +0000 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2013-03-22 15:28:53 +0100 |
commit | 5883d8b29691e15c72e338a586509abfc65c3106 (patch) | |
tree | 00e6f79f884563c46804f7a3742c3826f6ff16c5 /target-ppc/mmu-hash64.c | |
parent | 75d5ec89c03cb2f1a2bd0d9912e624ceb6fd1999 (diff) | |
download | hqemu-5883d8b29691e15c72e338a586509abfc65c3106.zip hqemu-5883d8b29691e15c72e338a586509abfc65c3106.tar.gz |
mmu-hash*: Don't use full ppc_hash{32, 64}_translate() path for get_phys_page_debug()
Currently the hash mmu versionsof get_phys_page_debug() use the same
ppc64_hash64_translate() function to do the translation logic as the normal
mm fault handler code.
That sounds like a good idea, but has some complications. The debug path
doesn't need, or even want some parts of the full translation path, like
permissions checking. Furthermore, the pte flags update included in the
normal path means that the debug call is not quite side effect free.
This patch, therefore, reimplements get_phys_page_debug as the minimal
required subset of the full translation path.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>`z
Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'target-ppc/mmu-hash64.c')
-rw-r--r-- | target-ppc/mmu-hash64.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/target-ppc/mmu-hash64.c b/target-ppc/mmu-hash64.c index d986c0f..4a7dbbb 100644 --- a/target-ppc/mmu-hash64.c +++ b/target-ppc/mmu-hash64.c @@ -449,13 +449,26 @@ static int ppc_hash64_translate(CPUPPCState *env, struct mmu_ctx_hash64 *ctx, hwaddr ppc_hash64_get_phys_page_debug(CPUPPCState *env, target_ulong addr) { - struct mmu_ctx_hash64 ctx; + ppc_slb_t *slb; + hwaddr pte_offset; + ppc_hash_pte64_t pte; + + if (msr_dr == 0) { + /* In real mode the top 4 effective address bits are ignored */ + return addr & 0x0FFFFFFFFFFFFFFFULL; + } - if (unlikely(ppc_hash64_translate(env, &ctx, addr, 0) != 0)) { + slb = slb_lookup(env, addr); + if (!slb) { + return -1; + } + + pte_offset = ppc_hash64_htab_lookup(env, slb, addr, &pte); + if (pte_offset == -1) { return -1; } - return ctx.raddr & TARGET_PAGE_MASK; + return ppc_hash64_pte_raddr(slb, pte, addr) & TARGET_PAGE_MASK; } int ppc_hash64_handle_mmu_fault(CPUPPCState *env, target_ulong address, int rwx, |