Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NULfy-0001Jz-SF for qemu-devel@nongnu.org; Mon, 11 Jan 2010 09:55:26 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NULfu-0001G3-6a for qemu-devel@nongnu.org; Mon, 11 Jan 2010 09:55:26 -0500 Received: from [199.232.76.173] (port=58792 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NULfu-0001Fp-0O for qemu-devel@nongnu.org; Mon, 11 Jan 2010 09:55:22 -0500 Received: from miranda.se.axis.com ([193.13.178.8]:43292) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NULfs-0003i8-LD for qemu-devel@nongnu.org; Mon, 11 Jan 2010 09:55:21 -0500 From: "Edgar E. Iglesias" Date: Mon, 11 Jan 2010 15:49:51 +0100 Message-Id: <1263221391-3642-5-git-send-email-edgar.iglesias@gmail.com> In-Reply-To: <1263221391-3642-4-git-send-email-edgar.iglesias@gmail.com> References: <1263221391-3642-1-git-send-email-edgar.iglesias@gmail.com> <1263221391-3642-2-git-send-email-edgar.iglesias@gmail.com> <1263221391-3642-3-git-send-email-edgar.iglesias@gmail.com> <1263221391-3642-4-git-send-email-edgar.iglesias@gmail.com> Subject: [Qemu-devel] [PATCH 4/4] ppc-40x: Correct ESR for zone protection faults. List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: "Edgar E. Iglesias" Raise the zone protection fault in ESR for TLB faults caused by zone protection bits. Signed-off-by: Edgar E. Iglesias --- target-ppc/helper.c | 23 ++++++++++++++++++----- 1 files changed, 18 insertions(+), 5 deletions(-) diff --git a/target-ppc/helper.c b/target-ppc/helper.c index f9b5589..a4fae31 100644 --- a/target-ppc/helper.c +++ b/target-ppc/helper.c @@ -1171,6 +1171,8 @@ static int mmu40x_get_physical_address (CPUState *env, mmu_ctx_t *ctx, break; case 0x0: if (pr != 0) { + /* Raise Zone protection fault. */ + env->spr[SPR_40x_ESR] = 1 << 22; ctx->prot = 0; ret = -2; break; @@ -1183,6 +1185,8 @@ static int mmu40x_get_physical_address (CPUState *env, mmu_ctx_t *ctx, ctx->prot = tlb->prot; ctx->prot |= PAGE_EXEC; ret = check_prot(ctx->prot, rw, access_type); + if (ret == -2) + env->spr[SPR_40x_ESR] = 0; break; } if (ret >= 0) { @@ -1580,11 +1584,20 @@ int cpu_ppc_handle_mmu_fault (CPUState *env, target_ulong address, int rw, /* Access rights violation */ env->exception_index = POWERPC_EXCP_DSI; env->error_code = 0; - env->spr[SPR_DAR] = address; - if (rw == 1) - env->spr[SPR_DSISR] = 0x0A000000; - else - env->spr[SPR_DSISR] = 0x08000000; + if (env->mmu_model == POWERPC_MMU_SOFT_4xx + || env->mmu_model == POWERPC_MMU_SOFT_4xx_Z) { + env->spr[SPR_40x_DEAR] = address; + if (rw) { + env->spr[SPR_40x_ESR] |= 0x00800000; + } + } else { + env->spr[SPR_DAR] = address; + if (rw == 1) { + env->spr[SPR_DSISR] = 0x0A000000; + } else { + env->spr[SPR_DSISR] = 0x08000000; + } + } break; case -4: /* Direct store exception */ -- 1.6.4.4