Skip to contentSkip to conversation

sparc: fix leon3 casa instruction when MMU is disabled

RFC PATCH In review KONRAD Frederic 2 participants 2 messages Mar 1, 2018

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 sparc: fix leon3 casa instruction when MMU is disabled

Since the commit af7a06bac7d3abb2da48ef3277d2a415772d2ae8:
casa [..](10), .., .. triggers a data access exception when the MMU is disabled.

This fixes this wrong behavior.

---

Notes:
There is an other way to do that: emiting the instruction with a MMU_PHYS_IDX when the MMU is disabled. I can switch to that if it's a prefered method.

 target/sparc/mmu_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target/sparc/mmu_helper.c +1 -1
index f8886ae..3cebf50 100644
@@ -100,7 +100,7 @@ static int get_physical_address(CPUSPARCState *env, hwaddr *physical,
 
     is_user = mmu_idx == MMU_USER_IDX;
 
-    if (mmu_idx == MMU_PHYS_IDX) {
+    if ((mmu_idx == MMU_PHYS_IDX) || ((env->mmuregs[0] & MMU_E) == 0)) {
         *page_size = TARGET_PAGE_SIZE;
         /* Boot mode: instruction fetches are taken from PROM */
         if (rw == 2 && (env->mmuregs[0] & env->def.mmu_bm)) {
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 3 lines · KONRAD Frederic

There is an other way to do that: emiting the instruction with a MMU_PHYS_IDX when the MMU is disabled. I can switch to that if it's a prefered method.

Yes, that would be preferred.

r~