Am 20.01.2012 04:17, schrieb Alexander Graf:
> When setting a TLB entry, we need to check if the TLB we're putting it in
> actually supports the given size. According to the 2.06 PowerPC ISA, a
> value that's out of range results in the minimum page size for the TLB
> to be used.
>
> Signed-off-by: Alexander Graf <[email protected]>
> ---
> target-ppc/op_helper.c | 11 +++++++++++
> 1 files changed, 11 insertions(+), 0 deletions(-)
>
> diff --git a/target-ppc/op_helper.c b/target-ppc/op_helper.c
> index 6339c95..0a88bf4 100644
> --- a/target-ppc/op_helper.c
> +++ b/target-ppc/op_helper.c
> @@ -4228,6 +4228,7 @@ void helper_booke206_tlbwe(void)
> {
> uint32_t tlbncfg, tlbn;
> ppcmas_tlb_t *tlb;
> + uint32_t size_tlb, size_min, size_max;
>
> switch (env->spr[SPR_BOOKE_MAS0] & MAS0_WQ_MASK) {
> case MAS0_WQ_ALWAYS:
> @@ -4273,6 +4274,16 @@ void helper_booke206_tlbwe(void)
> tlb->mas1 &= ~MAS1_IPROT;
> }
>
> + /* XXX only applies for MAV 1.0 */
> + size_tlb = (tlb->mas1 & MAS1_TSIZE_MASK) >> (MAS1_TSIZE_SHIFT + 1);
> + size_min = (tlbncfg & TLBnCFG_MINSIZE) >> TLBnCFG_MINSIZE_SHIFT;
> + size_max = (tlbncfg & TLBnCFG_MAXSIZE) >> TLBnCFG_MAXSIZE_SHIFT;
> + if ((size_tlb > size_max) || (size_tlb < size_max)) {
This looks wrong...?
Andreas
> + /* set to min size */
> + tlb->mas1 &= ~MAS1_TSIZE_MASK;
> + tlb->mas1 |= size_min << (MAS1_TSIZE_SHIFT + 1);
> + }
> +
> if (booke206_tlb_to_page_size(env, tlb) == TARGET_PAGE_SIZE) {
> tlb_flush_page(env, tlb->mas2 & MAS2_EPN_MASK);
> } else {
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg