mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 17:53:56 -06:00
Add translator_use_goto_tb.
Cleanups in prep of breakpoint fixes. Misc fixes. -----BEGIN PGP SIGNATURE----- iQFRBAABCgA7FiEEekgeeIaLTbaoWgXAZN846K9+IV8FAmDpvModHHJpY2hhcmQu aGVuZGVyc29uQGxpbmFyby5vcmcACgkQZN846K9+IV/1jgf+J1JMsPfxlSCwbbdc WEuWEcuKdcDFqhsePa6LaPYHTKuEEwavTG0kPbLIVZW2f6BTBeSYxAC6EWhq7pWo MGMhIOZM3fF0Yj+azuoybu9qxQ/K/aLM3GYt/OU00mvzturBezz+ka8MvWCrUwta XlhxhwnKsSP7lDWPBBjcdIIGiFJyxIRoU43giWaXrsvsc8ORJbmy7rgZfTKAit+w AvtQlc7TBi5nImz6f/KmEoy8mHEOhMf7czzo+v0u97lTiNK717/AHEwMfX9J585O GjlA9XmUUsNAciuLy48F1rHkgJxYAwo0G2shklpqPaOP5FctKm1reCSb8VEfAGaX Xq3UVA== =E9i/ -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/rth-gitlab/tags/pull-tcg-20210710' into staging Add translator_use_goto_tb. Cleanups in prep of breakpoint fixes. Misc fixes. # gpg: Signature made Sat 10 Jul 2021 16:29:14 BST # gpg: using RSA key 7A481E78868B4DB6A85A05C064DF38E8AF7E215F # gpg: issuer "richard.henderson@linaro.org" # gpg: Good signature from "Richard Henderson <richard.henderson@linaro.org>" [full] # Primary key fingerprint: 7A48 1E78 868B 4DB6 A85A 05C0 64DF 38E8 AF7E 215F * remotes/rth-gitlab/tags/pull-tcg-20210710: (41 commits) cpu: Add breakpoint tracepoints tcg: Remove TCG_TARGET_HAS_goto_ptr accel/tcg: Log tb->cflags with -d exec accel/tcg: Split out log_cpu_exec accel/tcg: Move tb_lookup to cpu-exec.c accel/tcg: Move helper_lookup_tb_ptr to cpu-exec.c target/i386: Use cpu_breakpoint_test in breakpoint_handler tcg: Fix prologue disassembly target/xtensa: Use translator_use_goto_tb target/tricore: Use tcg_gen_lookup_and_goto_ptr target/tricore: Use translator_use_goto_tb target/sparc: Use translator_use_goto_tb target/sh4: Use translator_use_goto_tb target/s390x: Remove use_exit_tb target/s390x: Use translator_use_goto_tb target/rx: Use translator_use_goto_tb target/riscv: Use translator_use_goto_tb target/ppc: Use translator_use_goto_tb target/openrisc: Use translator_use_goto_tb target/nios2: Use translator_use_goto_tb ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
bd38ae26ce
46 changed files with 217 additions and 439 deletions
|
@ -28,7 +28,6 @@
|
|||
#include "exec/cpu_ldst.h"
|
||||
#include "exec/helper-proto.h"
|
||||
#include "exec/helper-gen.h"
|
||||
#include "trace-tcg.h"
|
||||
#include "exec/translator.h"
|
||||
#include "exec/log.h"
|
||||
|
||||
|
@ -439,40 +438,9 @@ static DisasJumpType gen_store_conditional(DisasContext *ctx, int ra, int rb,
|
|||
return DISAS_NEXT;
|
||||
}
|
||||
|
||||
static bool in_superpage(DisasContext *ctx, int64_t addr)
|
||||
{
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
return ((ctx->tbflags & ENV_FLAG_PS_USER) == 0
|
||||
&& addr >> TARGET_VIRT_ADDR_SPACE_BITS == -1
|
||||
&& ((addr >> 41) & 3) == 2);
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool use_exit_tb(DisasContext *ctx)
|
||||
{
|
||||
return ((tb_cflags(ctx->base.tb) & CF_LAST_IO)
|
||||
|| ctx->base.singlestep_enabled
|
||||
|| singlestep);
|
||||
}
|
||||
|
||||
static bool use_goto_tb(DisasContext *ctx, uint64_t dest)
|
||||
{
|
||||
/* Suppress goto_tb in the case of single-steping and IO. */
|
||||
if (unlikely(use_exit_tb(ctx))) {
|
||||
return false;
|
||||
}
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
/* If the destination is in the superpage, the page perms can't change. */
|
||||
if (in_superpage(ctx, dest)) {
|
||||
return true;
|
||||
}
|
||||
/* Check for the dest on the same page as the start of the TB. */
|
||||
return ((ctx->base.tb->pc ^ dest) & TARGET_PAGE_MASK) == 0;
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
return translator_use_goto_tb(&ctx->base, dest);
|
||||
}
|
||||
|
||||
static DisasJumpType gen_bdirect(DisasContext *ctx, int ra, int32_t disp)
|
||||
|
@ -1271,7 +1239,7 @@ static DisasJumpType gen_call_pal(DisasContext *ctx, int palcode)
|
|||
need the page permissions check. We'll see the existence of
|
||||
the page when we create the TB, and we'll flush all TBs if
|
||||
we change the PAL base register. */
|
||||
if (!use_exit_tb(ctx)) {
|
||||
if (!ctx->base.singlestep_enabled) {
|
||||
tcg_gen_goto_tb(0);
|
||||
tcg_gen_movi_i64(cpu_pc, entry);
|
||||
tcg_gen_exit_tb(ctx->base.tb, 0);
|
||||
|
@ -3002,7 +2970,7 @@ static void alpha_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cpu)
|
|||
{
|
||||
DisasContext *ctx = container_of(dcbase, DisasContext, base);
|
||||
CPUAlphaState *env = cpu->env_ptr;
|
||||
int64_t bound, mask;
|
||||
int64_t bound;
|
||||
|
||||
ctx->tbflags = ctx->base.tb->flags;
|
||||
ctx->mem_idx = cpu_mmu_index(env, false);
|
||||
|
@ -3031,12 +2999,7 @@ static void alpha_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cpu)
|
|||
ctx->lit = NULL;
|
||||
|
||||
/* Bound the number of insns to execute to those left on the page. */
|
||||
if (in_superpage(ctx, ctx->base.pc_first)) {
|
||||
mask = -1ULL << 41;
|
||||
} else {
|
||||
mask = TARGET_PAGE_MASK;
|
||||
}
|
||||
bound = -(ctx->base.pc_first | mask) / 4;
|
||||
bound = -(ctx->base.pc_first | TARGET_PAGE_MASK) / 4;
|
||||
ctx->base.max_insns = MIN(ctx->base.max_insns, bound);
|
||||
}
|
||||
|
||||
|
@ -3095,7 +3058,7 @@ static void alpha_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu)
|
|||
tcg_gen_movi_i64(cpu_pc, ctx->base.pc_next);
|
||||
/* FALLTHRU */
|
||||
case DISAS_PC_UPDATED:
|
||||
if (!use_exit_tb(ctx)) {
|
||||
if (!ctx->base.singlestep_enabled) {
|
||||
tcg_gen_lookup_and_goto_ptr();
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
#include "exec/helper-gen.h"
|
||||
#include "exec/log.h"
|
||||
|
||||
#include "trace-tcg.h"
|
||||
#include "translate-a64.h"
|
||||
#include "qemu/atomic128.h"
|
||||
|
||||
|
@ -386,35 +385,20 @@ static void gen_step_complete_exception(DisasContext *s)
|
|||
s->base.is_jmp = DISAS_NORETURN;
|
||||
}
|
||||
|
||||
static inline bool use_goto_tb(DisasContext *s, int n, uint64_t dest)
|
||||
static inline bool use_goto_tb(DisasContext *s, uint64_t dest)
|
||||
{
|
||||
/* No direct tb linking with singlestep (either QEMU's or the ARM
|
||||
* debug architecture kind) or deterministic io
|
||||
*/
|
||||
if (s->base.singlestep_enabled || s->ss_active ||
|
||||
(tb_cflags(s->base.tb) & CF_LAST_IO)) {
|
||||
if (s->ss_active) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
/* Only link tbs from inside the same guest page */
|
||||
if ((s->base.tb->pc & TARGET_PAGE_MASK) != (dest & TARGET_PAGE_MASK)) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
return translator_use_goto_tb(&s->base, dest);
|
||||
}
|
||||
|
||||
static inline void gen_goto_tb(DisasContext *s, int n, uint64_t dest)
|
||||
{
|
||||
const TranslationBlock *tb;
|
||||
|
||||
tb = s->base.tb;
|
||||
if (use_goto_tb(s, n, dest)) {
|
||||
if (use_goto_tb(s, dest)) {
|
||||
tcg_gen_goto_tb(n);
|
||||
gen_a64_set_pc_im(dest);
|
||||
tcg_gen_exit_tb(tb, n);
|
||||
tcg_gen_exit_tb(s->base.tb, n);
|
||||
s->base.is_jmp = DISAS_NORETURN;
|
||||
} else {
|
||||
gen_a64_set_pc_im(dest);
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include "exec/helper-proto.h"
|
||||
#include "exec/helper-gen.h"
|
||||
#include "exec/log.h"
|
||||
#include "trace-tcg.h"
|
||||
#include "translate-a64.h"
|
||||
#include "fpu/softfloat.h"
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
#include "exec/helper-proto.h"
|
||||
#include "exec/helper-gen.h"
|
||||
|
||||
#include "trace-tcg.h"
|
||||
#include "exec/log.h"
|
||||
|
||||
|
||||
|
@ -2579,16 +2578,6 @@ static int disas_dsp_insn(DisasContext *s, uint32_t insn)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static inline bool use_goto_tb(DisasContext *s, target_ulong dest)
|
||||
{
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
return (s->base.tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK) ||
|
||||
((s->base.pc_next - 1) & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK);
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void gen_goto_ptr(void)
|
||||
{
|
||||
tcg_gen_lookup_and_goto_ptr();
|
||||
|
@ -2600,7 +2589,7 @@ static void gen_goto_ptr(void)
|
|||
*/
|
||||
static void gen_goto_tb(DisasContext *s, int n, target_ulong dest)
|
||||
{
|
||||
if (use_goto_tb(s, dest)) {
|
||||
if (translator_use_goto_tb(&s->base, dest)) {
|
||||
tcg_gen_goto_tb(n);
|
||||
gen_set_pc_im(s, dest);
|
||||
tcg_gen_exit_tb(s->base.tb, n);
|
||||
|
@ -8905,7 +8894,7 @@ static bool trans_ISB(DisasContext *s, arg_ISB *a)
|
|||
* self-modifying code correctly and also to take
|
||||
* any pending interrupts immediately.
|
||||
*/
|
||||
gen_goto_tb(s, 0, s->base.pc_next);
|
||||
s->base.is_jmp = DISAS_TOO_MANY;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -8919,7 +8908,7 @@ static bool trans_SB(DisasContext *s, arg_SB *a)
|
|||
* for TCG; MB and end the TB instead.
|
||||
*/
|
||||
tcg_gen_mb(TCG_MO_ALL | TCG_BAR_SC);
|
||||
gen_goto_tb(s, 0, s->base.pc_next);
|
||||
s->base.is_jmp = DISAS_TOO_MANY;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,10 +19,10 @@
|
|||
*/
|
||||
|
||||
DEF_HELPER_1(wdr, void, env)
|
||||
DEF_HELPER_1(debug, void, env)
|
||||
DEF_HELPER_1(break, void, env)
|
||||
DEF_HELPER_1(sleep, void, env)
|
||||
DEF_HELPER_1(unsupported, void, env)
|
||||
DEF_HELPER_1(debug, noreturn, env)
|
||||
DEF_HELPER_1(break, noreturn, env)
|
||||
DEF_HELPER_1(sleep, noreturn, env)
|
||||
DEF_HELPER_1(unsupported, noreturn, env)
|
||||
DEF_HELPER_3(outb, void, env, i32, i32)
|
||||
DEF_HELPER_2(inb, tl, env, i32)
|
||||
DEF_HELPER_3(fullwr, void, env, i32, i32)
|
||||
|
|
|
@ -1083,14 +1083,17 @@ static void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
|
|||
{
|
||||
const TranslationBlock *tb = ctx->base.tb;
|
||||
|
||||
if (!ctx->base.singlestep_enabled) {
|
||||
if (translator_use_goto_tb(&ctx->base, dest)) {
|
||||
tcg_gen_goto_tb(n);
|
||||
tcg_gen_movi_i32(cpu_pc, dest);
|
||||
tcg_gen_exit_tb(tb, n);
|
||||
} else {
|
||||
tcg_gen_movi_i32(cpu_pc, dest);
|
||||
gen_helper_debug(cpu_env);
|
||||
tcg_gen_exit_tb(NULL, 0);
|
||||
if (ctx->base.singlestep_enabled) {
|
||||
gen_helper_debug(cpu_env);
|
||||
} else {
|
||||
tcg_gen_lookup_and_goto_ptr();
|
||||
}
|
||||
}
|
||||
ctx->base.is_jmp = DISAS_NORETURN;
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
|
||||
#include "exec/helper-gen.h"
|
||||
|
||||
#include "trace-tcg.h"
|
||||
#include "exec/log.h"
|
||||
|
||||
|
||||
|
@ -482,7 +481,7 @@ static void t_gen_swapr(TCGv d, TCGv s)
|
|||
|
||||
static bool use_goto_tb(DisasContext *dc, target_ulong dest)
|
||||
{
|
||||
return ((dest ^ dc->base.pc_first) & TARGET_PAGE_MASK) == 0;
|
||||
return translator_use_goto_tb(&dc->base, dest);
|
||||
}
|
||||
|
||||
static void gen_goto_tb(DisasContext *dc, int n, target_ulong dest)
|
||||
|
@ -3235,8 +3234,7 @@ static void cris_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu)
|
|||
* Use a conditional branch if either taken or not-taken path
|
||||
* can use goto_tb. If neither can, then treat it as indirect.
|
||||
*/
|
||||
if (likely(!dc->base.singlestep_enabled)
|
||||
&& likely(!dc->cpustate_changed)
|
||||
if (likely(!dc->cpustate_changed)
|
||||
&& (use_goto_tb(dc, dc->jmp_pc) || use_goto_tb(dc, npc))) {
|
||||
TCGLabel *not_taken = gen_new_label();
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include "exec/helper-proto.h"
|
||||
#include "exec/helper-gen.h"
|
||||
#include "exec/translator.h"
|
||||
#include "trace-tcg.h"
|
||||
#include "exec/log.h"
|
||||
|
||||
/* Since we have a distinction between register size and address size,
|
||||
|
@ -817,10 +816,7 @@ static bool gen_illegal(DisasContext *ctx)
|
|||
|
||||
static bool use_goto_tb(DisasContext *ctx, target_ureg dest)
|
||||
{
|
||||
/* Suppress goto_tb for page crossing, IO, or single-steping. */
|
||||
return !(((ctx->base.pc_first ^ dest) & TARGET_PAGE_MASK)
|
||||
|| (tb_cflags(ctx->base.tb) & CF_LAST_IO)
|
||||
|| ctx->base.singlestep_enabled);
|
||||
return translator_use_goto_tb(&ctx->base, dest);
|
||||
}
|
||||
|
||||
/* If the next insn is to be nullified, and it's on the same page,
|
||||
|
|
|
@ -210,7 +210,6 @@ void breakpoint_handler(CPUState *cs)
|
|||
{
|
||||
X86CPU *cpu = X86_CPU(cs);
|
||||
CPUX86State *env = &cpu->env;
|
||||
CPUBreakpoint *bp;
|
||||
|
||||
if (cs->watchpoint_hit) {
|
||||
if (cs->watchpoint_hit->flags & BP_CPU) {
|
||||
|
@ -222,14 +221,9 @@ void breakpoint_handler(CPUState *cs)
|
|||
}
|
||||
}
|
||||
} else {
|
||||
QTAILQ_FOREACH(bp, &cs->breakpoints, entry) {
|
||||
if (bp->pc == env->eip) {
|
||||
if (bp->flags & BP_CPU) {
|
||||
check_hw_breakpoints(env, true);
|
||||
raise_exception(env, EXCP01_DB);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (cpu_breakpoint_test(cs, env->eip, BP_CPU)) {
|
||||
check_hw_breakpoints(env, true);
|
||||
raise_exception(env, EXCP01_DB);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include "exec/helper-gen.h"
|
||||
#include "helper-tcg.h"
|
||||
|
||||
#include "trace-tcg.h"
|
||||
#include "exec/log.h"
|
||||
|
||||
#define PREFIX_REPZ 0x01
|
||||
|
@ -2315,21 +2314,11 @@ static inline int insn_const_size(MemOp ot)
|
|||
}
|
||||
}
|
||||
|
||||
static inline bool use_goto_tb(DisasContext *s, target_ulong pc)
|
||||
{
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
return (pc & TARGET_PAGE_MASK) == (s->base.tb->pc & TARGET_PAGE_MASK) ||
|
||||
(pc & TARGET_PAGE_MASK) == (s->pc_start & TARGET_PAGE_MASK);
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void gen_goto_tb(DisasContext *s, int tb_num, target_ulong eip)
|
||||
static void gen_goto_tb(DisasContext *s, int tb_num, target_ulong eip)
|
||||
{
|
||||
target_ulong pc = s->cs_base + eip;
|
||||
|
||||
if (use_goto_tb(s, pc)) {
|
||||
if (translator_use_goto_tb(&s->base, pc)) {
|
||||
/* jump to same page: we can use a direct jump */
|
||||
tcg_gen_goto_tb(tb_num);
|
||||
gen_jmp_im(s, eip);
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#include "exec/helper-proto.h"
|
||||
#include "exec/helper-gen.h"
|
||||
|
||||
#include "trace-tcg.h"
|
||||
#include "exec/log.h"
|
||||
#include "fpu/softfloat.h"
|
||||
|
||||
|
@ -1520,16 +1519,6 @@ static void gen_exit_tb(DisasContext *s)
|
|||
} \
|
||||
} while (0)
|
||||
|
||||
static inline bool use_goto_tb(DisasContext *s, uint32_t dest)
|
||||
{
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
return (s->base.pc_first & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK)
|
||||
|| (s->base.pc_next & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK);
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Generate a jump to an immediate address. */
|
||||
static void gen_jmp_tb(DisasContext *s, int n, uint32_t dest)
|
||||
{
|
||||
|
@ -1537,7 +1526,7 @@ static void gen_jmp_tb(DisasContext *s, int n, uint32_t dest)
|
|||
update_cc_op(s);
|
||||
tcg_gen_movi_i32(QREG_PC, dest);
|
||||
gen_singlestep_exception(s);
|
||||
} else if (use_goto_tb(s, dest)) {
|
||||
} else if (translator_use_goto_tb(&s->base, dest)) {
|
||||
tcg_gen_goto_tb(n);
|
||||
tcg_gen_movi_i32(QREG_PC, dest);
|
||||
tcg_gen_exit_tb(s->base.tb, n);
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#include "exec/translator.h"
|
||||
#include "qemu/qemu-print.h"
|
||||
|
||||
#include "trace-tcg.h"
|
||||
#include "exec/log.h"
|
||||
|
||||
#define EXTRACT_FIELD(src, start, end) \
|
||||
|
@ -125,15 +124,6 @@ static void gen_raise_hw_excp(DisasContext *dc, uint32_t esr_ec)
|
|||
gen_raise_exception_sync(dc, EXCP_HW_EXCP);
|
||||
}
|
||||
|
||||
static inline bool use_goto_tb(DisasContext *dc, target_ulong dest)
|
||||
{
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
return (dc->base.pc_first & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK);
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void gen_goto_tb(DisasContext *dc, int n, target_ulong dest)
|
||||
{
|
||||
if (dc->base.singlestep_enabled) {
|
||||
|
@ -141,7 +131,7 @@ static void gen_goto_tb(DisasContext *dc, int n, target_ulong dest)
|
|||
tcg_gen_movi_i32(cpu_pc, dest);
|
||||
gen_helper_raise_exception(cpu_env, tmp);
|
||||
tcg_temp_free_i32(tmp);
|
||||
} else if (use_goto_tb(dc, dest)) {
|
||||
} else if (translator_use_goto_tb(&dc->base, dest)) {
|
||||
tcg_gen_goto_tb(n);
|
||||
tcg_gen_movi_i32(cpu_pc, dest);
|
||||
tcg_gen_exit_tb(dc->base.tb, n);
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include "semihosting/semihost.h"
|
||||
|
||||
#include "trace.h"
|
||||
#include "trace-tcg.h"
|
||||
#include "exec/translator.h"
|
||||
#include "exec/log.h"
|
||||
#include "qemu/qemu-print.h"
|
||||
|
@ -4948,22 +4947,9 @@ static void gen_trap(DisasContext *ctx, uint32_t opc,
|
|||
tcg_temp_free(t1);
|
||||
}
|
||||
|
||||
static inline bool use_goto_tb(DisasContext *ctx, target_ulong dest)
|
||||
static void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
|
||||
{
|
||||
if (unlikely(ctx->base.singlestep_enabled)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
return (ctx->base.tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK);
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
|
||||
{
|
||||
if (use_goto_tb(ctx, dest)) {
|
||||
if (translator_use_goto_tb(&ctx->base, dest)) {
|
||||
tcg_gen_goto_tb(n);
|
||||
gen_save_pc(dest);
|
||||
tcg_gen_exit_tb(ctx->base.tb, n);
|
||||
|
@ -4972,8 +4958,9 @@ static inline void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
|
|||
if (ctx->base.singlestep_enabled) {
|
||||
save_cpu_state(ctx, 0);
|
||||
gen_helper_raise_exception_debug(cpu_env);
|
||||
} else {
|
||||
tcg_gen_lookup_and_goto_ptr();
|
||||
}
|
||||
tcg_gen_lookup_and_goto_ptr();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -150,24 +150,11 @@ static void t_gen_helper_raise_exception(DisasContext *dc,
|
|||
dc->base.is_jmp = DISAS_NORETURN;
|
||||
}
|
||||
|
||||
static bool use_goto_tb(DisasContext *dc, uint32_t dest)
|
||||
{
|
||||
if (unlikely(dc->base.singlestep_enabled)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
return (dc->base.pc_first & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK);
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void gen_goto_tb(DisasContext *dc, int n, uint32_t dest)
|
||||
{
|
||||
const TranslationBlock *tb = dc->base.tb;
|
||||
|
||||
if (use_goto_tb(dc, dest)) {
|
||||
if (translator_use_goto_tb(&dc->base, dest)) {
|
||||
tcg_gen_goto_tb(n);
|
||||
tcg_gen_movi_tl(cpu_R[R_PC], dest);
|
||||
tcg_gen_exit_tb(tb, n);
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include "exec/helper-gen.h"
|
||||
#include "exec/gen-icount.h"
|
||||
|
||||
#include "trace-tcg.h"
|
||||
#include "exec/log.h"
|
||||
|
||||
/* is_jmp field values */
|
||||
|
@ -1720,16 +1719,17 @@ static void openrisc_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs)
|
|||
/* fallthru */
|
||||
|
||||
case DISAS_TOO_MANY:
|
||||
if (unlikely(dc->base.singlestep_enabled)) {
|
||||
tcg_gen_movi_tl(cpu_pc, jmp_dest);
|
||||
gen_exception(dc, EXCP_DEBUG);
|
||||
} else if ((dc->base.pc_first ^ jmp_dest) & TARGET_PAGE_MASK) {
|
||||
tcg_gen_movi_tl(cpu_pc, jmp_dest);
|
||||
tcg_gen_lookup_and_goto_ptr();
|
||||
} else {
|
||||
if (translator_use_goto_tb(&dc->base, jmp_dest)) {
|
||||
tcg_gen_goto_tb(0);
|
||||
tcg_gen_movi_tl(cpu_pc, jmp_dest);
|
||||
tcg_gen_exit_tb(dc->base.tb, 0);
|
||||
break;
|
||||
}
|
||||
tcg_gen_movi_tl(cpu_pc, jmp_dest);
|
||||
if (unlikely(dc->base.singlestep_enabled)) {
|
||||
gen_exception(dc, EXCP_DEBUG);
|
||||
} else {
|
||||
tcg_gen_lookup_and_goto_ptr();
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include "exec/helper-proto.h"
|
||||
#include "exec/helper-gen.h"
|
||||
|
||||
#include "trace-tcg.h"
|
||||
#include "exec/translator.h"
|
||||
#include "exec/log.h"
|
||||
#include "qemu/atomic128.h"
|
||||
|
@ -4302,15 +4301,7 @@ static inline void gen_update_cfar(DisasContext *ctx, target_ulong nip)
|
|||
|
||||
static inline bool use_goto_tb(DisasContext *ctx, target_ulong dest)
|
||||
{
|
||||
if (unlikely(ctx->singlestep_enabled)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
return (ctx->base.tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK);
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
return translator_use_goto_tb(&ctx->base, dest);
|
||||
}
|
||||
|
||||
static void gen_lookup_and_goto_ptr(DisasContext *ctx)
|
||||
|
|
|
@ -168,29 +168,11 @@ static void gen_exception_inst_addr_mis(DisasContext *ctx)
|
|||
generate_exception_mtval(ctx, RISCV_EXCP_INST_ADDR_MIS);
|
||||
}
|
||||
|
||||
static inline bool use_goto_tb(DisasContext *ctx, target_ulong dest)
|
||||
{
|
||||
if (unlikely(ctx->base.singlestep_enabled)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
return (ctx->base.tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK);
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
|
||||
{
|
||||
if (use_goto_tb(ctx, dest)) {
|
||||
/* chaining is only allowed when the jump is to the same page */
|
||||
if (translator_use_goto_tb(&ctx->base, dest)) {
|
||||
tcg_gen_goto_tb(n);
|
||||
tcg_gen_movi_tl(cpu_pc, dest);
|
||||
|
||||
/* No need to check for single stepping here as use_goto_tb() will
|
||||
* return false in case of single stepping.
|
||||
*/
|
||||
tcg_gen_exit_tb(ctx->base.tb, n);
|
||||
} else {
|
||||
tcg_gen_movi_tl(cpu_pc, dest);
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include "exec/helper-proto.h"
|
||||
#include "exec/helper-gen.h"
|
||||
#include "exec/translator.h"
|
||||
#include "trace-tcg.h"
|
||||
#include "exec/log.h"
|
||||
|
||||
typedef struct DisasContext {
|
||||
|
@ -143,18 +142,9 @@ void rx_cpu_dump_state(CPUState *cs, FILE *f, int flags)
|
|||
}
|
||||
}
|
||||
|
||||
static bool use_goto_tb(DisasContext *dc, target_ulong dest)
|
||||
{
|
||||
if (unlikely(dc->base.singlestep_enabled)) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
static void gen_goto_tb(DisasContext *dc, int n, target_ulong dest)
|
||||
{
|
||||
if (use_goto_tb(dc, dest)) {
|
||||
if (translator_use_goto_tb(&dc->base, dest)) {
|
||||
tcg_gen_goto_tb(n);
|
||||
tcg_gen_movi_i32(cpu_pc, dest);
|
||||
tcg_gen_exit_tb(dc->base.tb, n);
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
#include "exec/helper-proto.h"
|
||||
#include "exec/helper-gen.h"
|
||||
|
||||
#include "trace-tcg.h"
|
||||
#include "exec/translator.h"
|
||||
#include "exec/log.h"
|
||||
#include "qemu/atomic128.h"
|
||||
|
@ -685,24 +684,12 @@ static void gen_op_calc_cc(DisasContext *s)
|
|||
set_cc_static(s);
|
||||
}
|
||||
|
||||
static bool use_exit_tb(DisasContext *s)
|
||||
{
|
||||
return s->base.singlestep_enabled ||
|
||||
(tb_cflags(s->base.tb) & CF_LAST_IO) ||
|
||||
(s->base.tb->flags & FLAG_MASK_PER);
|
||||
}
|
||||
|
||||
static bool use_goto_tb(DisasContext *s, uint64_t dest)
|
||||
{
|
||||
if (unlikely(use_exit_tb(s))) {
|
||||
if (unlikely(s->base.tb->flags & FLAG_MASK_PER)) {
|
||||
return false;
|
||||
}
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
return (dest & TARGET_PAGE_MASK) == (s->base.tb->pc & TARGET_PAGE_MASK) ||
|
||||
(dest & TARGET_PAGE_MASK) == (s->base.pc_next & TARGET_PAGE_MASK);
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
return translator_use_goto_tb(&s->base, dest);
|
||||
}
|
||||
|
||||
static void account_noninline_branch(DisasContext *s, int cc_op)
|
||||
|
@ -6641,7 +6628,7 @@ static void s390x_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs)
|
|||
/* Exit the TB, either by raising a debug exception or by return. */
|
||||
if (dc->do_debug) {
|
||||
gen_exception(EXCP_DEBUG);
|
||||
} else if (use_exit_tb(dc) ||
|
||||
} else if ((dc->base.tb->flags & FLAG_MASK_PER) ||
|
||||
dc->base.is_jmp == DISAS_PC_STALE_NOCHAIN) {
|
||||
tcg_gen_exit_tb(NULL, 0);
|
||||
} else {
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include "exec/helper-proto.h"
|
||||
#include "exec/helper-gen.h"
|
||||
#include "exec/translator.h"
|
||||
#include "trace-tcg.h"
|
||||
#include "exec/log.h"
|
||||
#include "qemu/qemu-print.h"
|
||||
|
||||
|
@ -225,17 +224,12 @@ 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)
|
||||
static bool use_goto_tb(DisasContext *ctx, target_ulong dest)
|
||||
{
|
||||
/* Use a direct jump if in same page and singlestep not enabled */
|
||||
if (unlikely(ctx->base.singlestep_enabled || use_exit_tb(ctx))) {
|
||||
if (use_exit_tb(ctx)) {
|
||||
return false;
|
||||
}
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
return (ctx->base.tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK);
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
return translator_use_goto_tb(&ctx->base, dest);
|
||||
}
|
||||
|
||||
static void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
|
||||
#include "exec/helper-gen.h"
|
||||
|
||||
#include "trace-tcg.h"
|
||||
#include "exec/translator.h"
|
||||
#include "exec/log.h"
|
||||
#include "asi.h"
|
||||
|
@ -339,23 +338,14 @@ static inline TCGv gen_dest_gpr(DisasContext *dc, int reg)
|
|||
}
|
||||
}
|
||||
|
||||
static inline bool use_goto_tb(DisasContext *s, target_ulong pc,
|
||||
target_ulong npc)
|
||||
static bool use_goto_tb(DisasContext *s, target_ulong pc, target_ulong npc)
|
||||
{
|
||||
if (unlikely(s->base.singlestep_enabled || singlestep)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
return (pc & TARGET_PAGE_MASK) == (s->base.tb->pc & TARGET_PAGE_MASK) &&
|
||||
(npc & TARGET_PAGE_MASK) == (s->base.tb->pc & TARGET_PAGE_MASK);
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
return translator_use_goto_tb(&s->base, pc) &&
|
||||
translator_use_goto_tb(&s->base, npc);
|
||||
}
|
||||
|
||||
static inline void gen_goto_tb(DisasContext *s, int tb_num,
|
||||
target_ulong pc, target_ulong npc)
|
||||
static void gen_goto_tb(DisasContext *s, int tb_num,
|
||||
target_ulong pc, target_ulong npc)
|
||||
{
|
||||
if (use_goto_tb(s, pc, npc)) {
|
||||
/* jump to same page: we can use a direct jump */
|
||||
|
|
|
@ -3225,19 +3225,6 @@ static inline void gen_save_pc(target_ulong pc)
|
|||
tcg_gen_movi_tl(cpu_PC, pc);
|
||||
}
|
||||
|
||||
static inline bool use_goto_tb(DisasContext *ctx, target_ulong dest)
|
||||
{
|
||||
if (unlikely(ctx->base.singlestep_enabled)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
return (ctx->base.tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK);
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void generate_qemu_excp(DisasContext *ctx, int excp)
|
||||
{
|
||||
TCGv_i32 tmp = tcg_const_i32(excp);
|
||||
|
@ -3246,9 +3233,9 @@ static void generate_qemu_excp(DisasContext *ctx, int excp)
|
|||
tcg_temp_free(tmp);
|
||||
}
|
||||
|
||||
static inline void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
|
||||
static void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
|
||||
{
|
||||
if (use_goto_tb(ctx, dest)) {
|
||||
if (translator_use_goto_tb(&ctx->base, dest)) {
|
||||
tcg_gen_goto_tb(n);
|
||||
gen_save_pc(dest);
|
||||
tcg_gen_exit_tb(ctx->base.tb, n);
|
||||
|
@ -3256,8 +3243,9 @@ static inline void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
|
|||
gen_save_pc(dest);
|
||||
if (ctx->base.singlestep_enabled) {
|
||||
generate_qemu_excp(ctx, EXCP_DEBUG);
|
||||
} else {
|
||||
tcg_gen_lookup_and_goto_ptr();
|
||||
}
|
||||
tcg_gen_exit_tb(NULL, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,6 @@
|
|||
#include "exec/helper-proto.h"
|
||||
#include "exec/helper-gen.h"
|
||||
|
||||
#include "trace-tcg.h"
|
||||
#include "exec/log.h"
|
||||
|
||||
|
||||
|
@ -406,11 +405,7 @@ static void gen_jump(DisasContext *dc, TCGv dest)
|
|||
|
||||
static int adjust_jump_slot(DisasContext *dc, uint32_t dest, int slot)
|
||||
{
|
||||
if (((dc->base.pc_first ^ dest) & TARGET_PAGE_MASK) != 0) {
|
||||
return -1;
|
||||
} else {
|
||||
return slot;
|
||||
}
|
||||
return translator_use_goto_tb(&dc->base, dest) ? slot : -1;
|
||||
}
|
||||
|
||||
static void gen_jumpi(DisasContext *dc, uint32_t dest, int slot)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue