Skip to contentSkip to conversation

PPC: e500: Fix TLB lookup for 32bit CPUs

PATCH New Alexander Graf 1 participant 1 message Jun 3, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PPC: e500: Fix TLB lookup for 32bit CPUs

When we run 32bit guest CPUs (or 32bit guest code on 64bit CPUs) on qemu-system-ppc64 the TLB lookup will use the full effective address as pointer.

However, only the first 32bits are valid when MSR.CM = 0. Check for that condition.

This makes QEMU boot an e500v2 guest with more than 1G of RAM for me.

---
 target-ppc/mmu_helper.c | 5 +++++
 1 file changed, 5 insertions(+)
target-ppc/mmu_helper.c +5 -0
index 298e570..12e954c 100644
@@ -902,6 +902,11 @@ static int ppcmas_tlb_check(CPUPPCState *env, ppcmas_tlb_t *tlb,
     target_ulong mask;
     uint32_t tlb_pid;
 
+    if (!msr_cm) {
+        /* In 32bit mode we can only address 32bit EAs */
+        address = (uint32_t)address;
+    }
+
     /* Check valid flag */
     if (!(tlb->mas1 & MAS1_VALID)) {
         return -1;
Signature · 1 line
1.8.1.4