target-sh4: update PTEH upon MMU exception
authorAlexandre Courbot <gnurou@gmail.com>
Wed, 26 Jan 2011 02:57:53 +0000 (11:57 +0900)
committerAurelien Jarno <aurelien@aurel32.net>
Wed, 26 Jan 2011 13:30:24 +0000 (14:30 +0100)
Update the PTEH register to contain the VPN at which an MMU
exception occured as specified by the SH4 reference.

Signed-off-by: Alexandre Courbot <gnurou@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
target-sh4/helper.c

index 785e9e54e74089ea84fa08a8fb81fea961942dd0..d2038bd8422ee37f3b2fee26e6e70fcbb29bac31 100644 (file)
@@ -453,6 +453,10 @@ int cpu_sh4_handle_mmu_fault(CPUState * env, target_ulong address, int rw,
 
     if (ret != MMU_OK) {
        env->tea = address;
+       if (ret != MMU_DTLB_MULTIPLE && ret != MMU_ITLB_MULTIPLE) {
+           env->pteh = (env->pteh & PTEH_ASID_MASK) |
+                   (address & PTEH_VPN_MASK);
+       }
        switch (ret) {
        case MMU_ITLB_MISS:
        case MMU_DTLB_MISS_READ: