Skip to contentSkip to conversation

MIPS64: Fix XContext on exception

PATCH New Hervé Poussineau 1 participant 1 message Sep 21, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MIPS64: Fix XContext on exception

Hi,

Attached patch fixes XContext filling on exception, and prevents R field to sometimes override BadVPN2 field. R field location was correct only when SEGBITS was 32, which is the case on MIPS32, but not MIPS64.

Hervé

helper.c +1 -1
Index: target-mips/helper.c
===================================================================
@@ -304,7 +304,7 @@
 #if defined(TARGET_MIPS64)
         env->CP0_EntryHi &= env->SEGMask;
         env->CP0_XContext = (env->CP0_XContext & ((~0ULL) << (env->SEGBITS - 7))) |
-                            ((address & 0xC00000000000ULL) >> (env->SEGBITS - 9)) |
+                            ((address & 0xC00000000000ULL) >> (55 - env->SEGBITS)) |
                             ((address & ((1ULL << env->SEGBITS) - 1) & 0xFFFFFFFFFFFFE000ULL) >> 9);
 #endif
         env->exception_index = exception;