diff --git a/trunk/target-ppc/op_helper.c b/trunk/target-ppc/op_helper.c --- a/trunk/target-ppc/op_helper.c +++ b/trunk/target-ppc/op_helper.c @@ -2806,7 +2806,7 @@ void do_4xx_tlbwe_hi (void) tlb->prot |= PAGE_VALID; else tlb->prot &= ~PAGE_VALID; - if (T1 & 0x20) { + if (T1 & 0x40 && T1 & 0x20) { /* XXX: TO BE FIXED */ cpu_abort(env, "Little-endian TLB entries are not supported by now\n"); } @@ -2849,11 +2849,20 @@ void do_4xx_tlbwe_lo (void) T0 &= 0x3F; tlb = &env->tlb[T0].tlbe; tlb->RPN = T1 & 0xFFFFFC00; - tlb->prot = PAGE_READ; + tlb->prot &= ~(PAGE_EXEC | PAGE_WRITE); + tlb->prot |= PAGE_READ; if (T1 & 0x200) tlb->prot |= PAGE_EXEC; if (T1 & 0x100) tlb->prot |= PAGE_WRITE; + + /* If the page is valid flush it for the prot change */ + if (tlb->prot & PAGE_VALID) { + target_ulong page, end; + end = tlb->EPN + tlb->size; + for (page = tlb->EPN; page < end; page += TARGET_PAGE_SIZE) + tlb_flush_page(env, page); + } #if defined (DEBUG_SOFTWARE_TLB) if (loglevel != 0) { fprintf(logfile, "%s: set up TLB %d RPN " PADDRX " EPN " ADDRX