Skip to content

Commit 18614aa

Browse files
committed
[ot] target/riscv: do not use translator_lduw in riscv_tr_translate_insn
translator_lduw in used in riscv_tr_translate_insn not for an actual translation but only to check if an instruction crosses a page boundary. Switch back to cpu_lduw_code otherwise an assert can be triggered in some cases: qemu-system-riscv32: ../accel/tcg/translator.c:395: record_save: Assertion `offset == db->record_start + db->record_len' failed. Fixes: 1f9c446 ("target/riscv: Use translator_ld* for everything") Signed-off-by: Loïc Lefort <loic@rivosinc.com>
1 parent 7b0c653 commit 18614aa

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

target/riscv/translate.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "exec/helper-gen.h"
2525
#include "exec/target_page.h"
2626
#include "exec/translator.h"
27+
#include "accel/tcg/cpu-ldst.h"
2728
#include "exec/translation-block.h"
2829
#include "exec/log.h"
2930
#include "semihosting/semihost.h"
@@ -1378,8 +1379,7 @@ static void riscv_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
13781379
unsigned page_ofs = ctx->base.pc_next & ~TARGET_PAGE_MASK;
13791380

13801381
if (page_ofs > TARGET_PAGE_SIZE - MAX_INSN_LEN) {
1381-
uint16_t next_insn =
1382-
translator_lduw(env, &ctx->base, ctx->base.pc_next);
1382+
uint16_t next_insn = cpu_lduw_code(env, ctx->base.pc_next);
13831383
int len = insn_len(next_insn);
13841384

13851385
if (!translator_is_same_page(&ctx->base, ctx->base.pc_next + len - 1)) {

0 commit comments

Comments
 (0)