summary refs log tree commit diff stats
path: root/target/loongarch/translate.c
diff options
context:
space:
mode:
Diffstat (limited to 'target/loongarch/translate.c')
-rw-r--r--target/loongarch/translate.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/target/loongarch/translate.c b/target/loongarch/translate.c
index 31462b2b61..38ced69803 100644
--- a/target/loongarch/translate.c
+++ b/target/loongarch/translate.c
@@ -75,10 +75,11 @@ static void loongarch_tr_init_disas_context(DisasContextBase *dcbase,
     DisasContext *ctx = container_of(dcbase, DisasContext, base);
 
     ctx->page_start = ctx->base.pc_first & TARGET_PAGE_MASK;
+    ctx->plv = ctx->base.tb->flags & HW_FLAGS_PLV_MASK;
     if (ctx->base.tb->flags & HW_FLAGS_CRMD_PG) {
-        ctx->mem_idx = ctx->base.tb->flags & HW_FLAGS_PLV_MASK;
+        ctx->mem_idx = ctx->plv;
     } else {
-        ctx->mem_idx = MMU_DA_IDX;
+        ctx->mem_idx = MMU_IDX_DA;
     }
 
     /* Bound the number of insns to execute to those left on the page.  */