target-mips: fix updating XContext on mmu exception
PATCH 1/1 target-mips: fix updating XContext on mmu exception
Correct updating XContext.Region field on mmu exceptions. If Config3.CTXTC = 0 then the R filed of XContext has to be updated with the value of bits 63..62 of the virtual address upon a TLB exception.
--- target-mips/helper.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
target-mips/helper.c +1 -1
@@ -294,7 +294,7 @@ static void raise_mmu_exception(CPUMIPSState *env, target_ulong address,#if defined(TARGET_MIPS64 ) env->CP0_EntryHi &= env->SEGMask; env->CP0_XContext = (env->CP0_XContext & ((~0ULL ) << (env->SEGBITS -7 ))) | - ((address &0xC00000000000ULL ) >> (55 - env->SEGBITS)) | + (((address >>62 ) &0x3 ) << (env->SEGBITS -9 )) | ((address & ((1ULL << env->SEGBITS) -1 ) &0xFFFFFFFFFFFFE000ULL ) >>9 );#endif cs->exception_index = exception;
Signature · 1 line
1.7.1
Quoted 2 lines · Yongbok Kim
Correct updating XContext.Region field on mmu exceptions. If Config3.CTXTC = 0 then the R filed of XContext has to be updated
s/filed/field
Quoted 13 lines
with the value of bits 63..62 of the virtual address upon a TLB exception.
Signed-off-by Yongbok Kim <[email protected]>--- target-mips/helper.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)target-mips/helper.c +0
-0
target-mips/helper.c static void raise_mmu_exception(CPUMIPSState *env, target_ulong address, · line 297
Quoted 5 lines
target-mips/helper.c +1
-1@@ -294,7 +294,7 @@ static void raise_mmu_exception(CPUMIPSState *env, target_ulong address,#if defined(TARGET_MIPS64 ) env->CP0_EntryHi &= env->SEGMask; env->CP0_XContext = (env->CP0_XContext & ((~0ULL ) << (env->SEGBITS -7 ))) | - ((address & 0xC00000000000ULL) >> (55 - env->SEGBITS)) | + (((address >> 62) & 0x3) << (env->SEGBITS - 9)) |
Did you consider using extract64?
target-mips/helper.c static void raise_mmu_exception(CPUMIPSState *env, target_ulong address, · line 298
Quoted 1 line
target-mips/helper.c +0
-0((address & ((1ULL << env->SEGBITS) -1 ) &0xFFFFFFFFFFFFE000ULL ) >>9 );
Care to fix this >80 chars line while you are on this? :)
Thanks,
Leon
Quoted 3 lines
target-mips/helper.c +0
-0#endif cs->exception_index = exception;