[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 27/30] target/sh4: Use tcg_gen_lookup_and_goto_pt
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [PATCH v3 27/30] target/sh4: Use tcg_gen_lookup_and_goto_ptr |
Date: |
Tue, 18 Jul 2017 10:02:52 -1000 |
Signed-off-by: Richard Henderson <address@hidden>
---
target/sh4/translate.c | 30 ++++++++++++++++++++----------
1 file changed, 20 insertions(+), 10 deletions(-)
diff --git a/target/sh4/translate.c b/target/sh4/translate.c
index 12d5ed7..ab81084 100644
--- a/target/sh4/translate.c
+++ b/target/sh4/translate.c
@@ -235,12 +235,15 @@ static inline void gen_save_cpu_state(DisasContext *ctx,
bool save_pc)
}
}
+static inline bool use_exit_tb(DisasContext *ctx)
+{
+ return (ctx->tbflags & GUSA_EXCLUSIVE) != 0;
+}
+
static inline bool use_goto_tb(DisasContext *ctx, target_ulong dest)
{
- if (unlikely(ctx->singlestep_enabled)) {
- return false;
- }
- if (ctx->tbflags & GUSA_EXCLUSIVE) {
+ /* Use a direct jump if in same page and singlestep not enabled */
+ if (unlikely(ctx->singlestep_enabled || use_exit_tb(ctx))) {
return false;
}
#ifndef CONFIG_USER_ONLY
@@ -253,28 +256,35 @@ static inline bool use_goto_tb(DisasContext *ctx,
target_ulong dest)
static void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
{
if (use_goto_tb(ctx, dest)) {
- /* Use a direct jump if in same page and singlestep not enabled */
tcg_gen_goto_tb(n);
tcg_gen_movi_i32(cpu_pc, dest);
tcg_gen_exit_tb((uintptr_t)ctx->tb + n);
} else {
tcg_gen_movi_i32(cpu_pc, dest);
- if (ctx->singlestep_enabled)
+ if (ctx->singlestep_enabled) {
gen_helper_debug(cpu_env);
- tcg_gen_exit_tb(0);
+ } else if (use_exit_tb(ctx)) {
+ tcg_gen_exit_tb(0);
+ } else {
+ tcg_gen_lookup_and_goto_ptr(cpu_pc);
+ }
}
}
static void gen_jump(DisasContext * ctx)
{
- if (ctx->delayed_pc == (uint32_t) - 1) {
+ if (ctx->delayed_pc == -1) {
/* Target is not statically known, it comes necessarily from a
delayed jump as immediate jump are conditinal jumps */
tcg_gen_mov_i32(cpu_pc, cpu_delayed_pc);
tcg_gen_discard_i32(cpu_delayed_pc);
- if (ctx->singlestep_enabled)
+ if (ctx->singlestep_enabled) {
gen_helper_debug(cpu_env);
- tcg_gen_exit_tb(0);
+ } else if (use_exit_tb(ctx)) {
+ tcg_gen_exit_tb(0);
+ } else {
+ tcg_gen_lookup_and_goto_ptr(cpu_pc);
+ }
} else {
gen_goto_tb(ctx, 0, ctx->delayed_pc);
}
--
2.9.4
- [Qemu-devel] [PATCH v3 18/30] target/sh4: Unify code for CHECK_NOT_DELAY_SLOT, (continued)
- [Qemu-devel] [PATCH v3 18/30] target/sh4: Unify code for CHECK_NOT_DELAY_SLOT, Richard Henderson, 2017/07/18
- [Qemu-devel] [PATCH v3 15/30] target/sh4: Merge DREG into fpr64 routines, Richard Henderson, 2017/07/18
- [Qemu-devel] [PATCH v3 19/30] target/sh4: Unify code for CHECK_PRIVILEGED, Richard Henderson, 2017/07/18
- [Qemu-devel] [PATCH v3 20/30] target/sh4: Unify code for CHECK_FPU_ENABLED, Richard Henderson, 2017/07/18
- [Qemu-devel] [PATCH v3 21/30] target/sh4: Tidy misc illegal insn checks, Richard Henderson, 2017/07/18
- [Qemu-devel] [PATCH v3 22/30] target/sh4: Introduce CHECK_FPSCR_PR_*, Richard Henderson, 2017/07/18
- [Qemu-devel] [PATCH v3 24/30] target/sh4: Implement fpchg, Richard Henderson, 2017/07/18
- [Qemu-devel] [PATCH v3 23/30] target/sh4: Introduce CHECK_SH4A, Richard Henderson, 2017/07/18
- [Qemu-devel] [PATCH v3 25/30] target/sh4: Add missing FPSCR.PR == 0 checks, Richard Henderson, 2017/07/18
- [Qemu-devel] [PATCH v3 26/30] target/sh4: Implement fsrra, Richard Henderson, 2017/07/18
- [Qemu-devel] [PATCH v3 27/30] target/sh4: Use tcg_gen_lookup_and_goto_ptr,
Richard Henderson <=
- [Qemu-devel] [PATCH v3 28/30] tcg: Fix off-by-one in assert in page_set_flags, Richard Henderson, 2017/07/18
- [Qemu-devel] [PATCH v3 30/30] linux-user/sh4: Reduce TARGET_VIRT_ADDR_SPACE_BITS to 31, Richard Henderson, 2017/07/18
- [Qemu-devel] [PATCH v3 29/30] linux-user: Tidy and enforce reserved_va initialization, Richard Henderson, 2017/07/18
- Re: [Qemu-devel] [PATCH v3 00/30] target/sh4 improvements, Aurelien Jarno, 2017/07/18