Received: from eggs.gnu.org ([2001:4830:134:3::10]:43109) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WrxDL-0008Pv-9E for qemu-devel@nongnu.org; Tue, 03 Jun 2014 18:29:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WrxDF-0001Tw-LE for qemu-devel@nongnu.org; Tue, 03 Jun 2014 18:29:51 -0400 From: Alexander Graf Date: Wed, 4 Jun 2014 00:29:44 +0200 Message-Id: <1401834584-57336-1-git-send-email-agraf@suse.de> Subject: [Qemu-devel] [PATCH] PPC: e500: Fix TLB lookup for 32bit CPUs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-ppc@nongnu.org Cc: qemu-devel@nongnu.org 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. Signed-off-by: Alexander Graf --- target-ppc/mmu_helper.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/target-ppc/mmu_helper.c b/target-ppc/mmu_helper.c index 298e570..12e954c 100644 --- a/target-ppc/mmu_helper.c +++ b/target-ppc/mmu_helper.c @@ -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; -- 1.8.1.4