Skip to content

Commit 273b68b

Browse files
committed
target/riscv: Remove exit_tb and lookup_and_goto_ptr
GDB single-stepping is now handled generically, which means we don't need to do anything in the wrappers. Reviewed-by: Alistair Francis <[email protected]> Signed-off-by: Richard Henderson <[email protected]>
1 parent ea06a00 commit 273b68b

File tree

4 files changed

+7
-34
lines changed

4 files changed

+7
-34
lines changed

target/riscv/insn_trans/trans_privileged.c.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ static bool trans_sret(DisasContext *ctx, arg_sret *a)
7878

7979
if (has_ext(ctx, RVS)) {
8080
gen_helper_sret(cpu_pc, cpu_env, cpu_pc);
81-
exit_tb(ctx); /* no chaining */
81+
tcg_gen_exit_tb(NULL, 0); /* no chaining */
8282
ctx->base.is_jmp = DISAS_NORETURN;
8383
} else {
8484
return false;
@@ -94,7 +94,7 @@ static bool trans_mret(DisasContext *ctx, arg_mret *a)
9494
#ifndef CONFIG_USER_ONLY
9595
tcg_gen_movi_tl(cpu_pc, ctx->base.pc_next);
9696
gen_helper_mret(cpu_pc, cpu_env, cpu_pc);
97-
exit_tb(ctx); /* no chaining */
97+
tcg_gen_exit_tb(NULL, 0); /* no chaining */
9898
ctx->base.is_jmp = DISAS_NORETURN;
9999
return true;
100100
#else

target/riscv/insn_trans/trans_rvi.c.inc

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,7 @@ static bool trans_jalr(DisasContext *ctx, arg_jalr *a)
7171
if (a->rd != 0) {
7272
tcg_gen_movi_tl(cpu_gpr[a->rd], ctx->pc_succ_insn);
7373
}
74-
75-
/* No chaining with JALR. */
76-
lookup_and_goto_ptr(ctx);
74+
tcg_gen_lookup_and_goto_ptr();
7775

7876
if (misaligned) {
7977
gen_set_label(misaligned);
@@ -421,7 +419,7 @@ static bool trans_fence_i(DisasContext *ctx, arg_fence_i *a)
421419
* however we need to end the translation block
422420
*/
423421
tcg_gen_movi_tl(cpu_pc, ctx->pc_succ_insn);
424-
exit_tb(ctx);
422+
tcg_gen_exit_tb(NULL, 0);
425423
ctx->base.is_jmp = DISAS_NORETURN;
426424
return true;
427425
}
@@ -430,7 +428,7 @@ static bool do_csr_post(DisasContext *ctx)
430428
{
431429
/* We may have changed important cpu state -- exit to main loop. */
432430
tcg_gen_movi_tl(cpu_pc, ctx->pc_succ_insn);
433-
exit_tb(ctx);
431+
tcg_gen_exit_tb(NULL, 0);
434432
ctx->base.is_jmp = DISAS_NORETURN;
435433
return true;
436434
}

target/riscv/insn_trans/trans_rvv.c.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ static bool trans_vsetvl(DisasContext *ctx, arg_vsetvl *a)
4141
gen_set_gpr(ctx, a->rd, dst);
4242

4343
tcg_gen_movi_tl(cpu_pc, ctx->pc_succ_insn);
44-
lookup_and_goto_ptr(ctx);
44+
tcg_gen_lookup_and_goto_ptr();
4545
ctx->base.is_jmp = DISAS_NORETURN;
4646
return true;
4747
}

target/riscv/translate.c

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -149,31 +149,6 @@ static void generate_exception_mtval(DisasContext *ctx, int excp)
149149
ctx->base.is_jmp = DISAS_NORETURN;
150150
}
151151

152-
static void gen_exception_debug(void)
153-
{
154-
gen_helper_raise_exception(cpu_env, tcg_constant_i32(EXCP_DEBUG));
155-
}
156-
157-
/* Wrapper around tcg_gen_exit_tb that handles single stepping */
158-
static void exit_tb(DisasContext *ctx)
159-
{
160-
if (ctx->base.singlestep_enabled) {
161-
gen_exception_debug();
162-
} else {
163-
tcg_gen_exit_tb(NULL, 0);
164-
}
165-
}
166-
167-
/* Wrapper around tcg_gen_lookup_and_goto_ptr that handles single stepping */
168-
static void lookup_and_goto_ptr(DisasContext *ctx)
169-
{
170-
if (ctx->base.singlestep_enabled) {
171-
gen_exception_debug();
172-
} else {
173-
tcg_gen_lookup_and_goto_ptr();
174-
}
175-
}
176-
177152
static void gen_exception_illegal(DisasContext *ctx)
178153
{
179154
generate_exception(ctx, RISCV_EXCP_ILLEGAL_INST);
@@ -192,7 +167,7 @@ static void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
192167
tcg_gen_exit_tb(ctx->base.tb, n);
193168
} else {
194169
tcg_gen_movi_tl(cpu_pc, dest);
195-
lookup_and_goto_ptr(ctx);
170+
tcg_gen_lookup_and_goto_ptr();
196171
}
197172
}
198173

0 commit comments

Comments
 (0)