aboutsummaryrefslogtreecommitdiff
path: root/target/loongarch/translate.c
diff options
context:
space:
mode:
Diffstat (limited to 'target/loongarch/translate.c')
-rw-r--r--target/loongarch/translate.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/target/loongarch/translate.c b/target/loongarch/translate.c
index 6091772349..31462b2b61 100644
--- a/target/loongarch/translate.c
+++ b/target/loongarch/translate.c
@@ -75,7 +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->mem_idx = ctx->base.tb->flags;
+ if (ctx->base.tb->flags & HW_FLAGS_CRMD_PG) {
+ ctx->mem_idx = ctx->base.tb->flags & HW_FLAGS_PLV_MASK;
+ } else {
+ ctx->mem_idx = MMU_DA_IDX;
+ }
/* Bound the number of insns to execute to those left on the page. */
bound = -(ctx->base.pc_first | TARGET_PAGE_MASK) / 4;