[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH 25/72] booke_206_tlbwe: Discard invalid bits in MAS2
From: |
Alexander Graf |
Subject: |
[Qemu-ppc] [PATCH 25/72] booke_206_tlbwe: Discard invalid bits in MAS2 |
Date: |
Sun, 24 Jun 2012 01:06:49 +0200 |
From: Fabien Chouteau <address@hidden>
The size of EPN field in MAS2 depends on page size. This patch adds a
mask to discard invalid bits in EPN field.
Definition of EPN field from e500v2 RM:
EPN Effective page number: Depending on page size, only the bits
associated with a page boundary are valid. Bits that represent offsets
within a page are ignored and should be cleared.
There is a similar (but more complicated) definition in PowerISA V2.06.
Signed-off-by: Fabien Chouteau <address@hidden>
Signed-off-by: Alexander Graf <address@hidden>
---
target-ppc/mmu_helper.c | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/target-ppc/mmu_helper.c b/target-ppc/mmu_helper.c
index d65d290..c4e79d9 100644
--- a/target-ppc/mmu_helper.c
+++ b/target-ppc/mmu_helper.c
@@ -3019,6 +3019,8 @@ void helper_booke206_tlbwe(CPUPPCState *env)
uint32_t tlbncfg, tlbn;
ppcmas_tlb_t *tlb;
uint32_t size_tlb, size_ps;
+ target_ulong mask;
+
switch (env->spr[SPR_BOOKE_MAS0] & MAS0_WQ_MASK) {
case MAS0_WQ_ALWAYS:
@@ -3081,8 +3083,19 @@ void helper_booke206_tlbwe(CPUPPCState *env)
tlb->mas1 |= (tlbncfg & TLBnCFG_MINSIZE) >> 12;
}
- /* XXX needs to change when supporting 64-bit e500 */
- tlb->mas2 = env->spr[SPR_BOOKE_MAS2] & 0xffffffff;
+ /* Make a mask from TLB size to discard invalid bits in EPN field */
+ mask = ~(booke206_tlb_to_page_size(env, tlb) - 1);
+ /* Add a mask for page attributes */
+ mask |= MAS2_ACM | MAS2_VLE | MAS2_W | MAS2_I | MAS2_M | MAS2_G | MAS2_E;
+
+ if (!msr_cm) {
+ /* Executing a tlbwe instruction in 32-bit mode will set
+ * bits 0:31 of the TLB EPN field to zero.
+ */
+ mask &= 0xffffffff;
+ }
+
+ tlb->mas2 = env->spr[SPR_BOOKE_MAS2] & mask;
if (!(tlbncfg & TLBnCFG_IPROT)) {
/* no IPROT supported by TLB */
--
1.6.0.2
- [Qemu-ppc] [PATCH 12/72] ppc: Avoid a warning with the next patch, (continued)
- [Qemu-ppc] [PATCH 12/72] ppc: Avoid a warning with the next patch, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 21/72] ppc: Add missing break, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 15/72] ppc: Split off timebase helpers, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 22/72] ppc: Make hbrev table const, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 03/72] ppc: Avoid AREG0 for exception helpers, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 16/72] ppc: Avoid AREG0 for timebase helpers, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 14/72] ppc: Cleanup MMU merge, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 09/72] ppc: Avoid AREG0 for integer and vector helpers, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 17/72] ppc: Split off misc helpers, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 04/72] ppc: Fix coding style in helper.c, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 25/72] booke_206_tlbwe: Discard invalid bits in MAS2,
Alexander Graf <=
- [Qemu-ppc] [PATCH 23/72] PPC: mpc8544ds: Span initial TLB entry over as much RAM as we need, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 24/72] Avoid segfault in cpu_dump_state, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 28/72] spapr_vscsi: Error handling fixes, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 20/72] ppc: Move load and store helpers, switch to AREG0 free mode, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 31/72] dt: allow add_subnode to create root subnodes, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 34/72] dt: temporarily disable subtree creation failure check, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 37/72] dt: add helper for phandle allocation, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 38/72] dt: add helper for 64bit cell adds, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 41/72] PPC: e500: dt: create /cpus node dynamically, Alexander Graf, 2012/06/23
- [Qemu-ppc] [PATCH 26/72] ppc64: Rudimentary Support for extra page sizes on server CPUs, Alexander Graf, 2012/06/23