mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-09 10:34:58 -06:00
accel/tcg: Introduce translator_io_start
New wrapper around gen_io_start which takes care of the USE_ICOUNT check, as well as marking the DisasContext to end the TB. Remove exec/gen-icount.h. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
5623423359
commit
dfd1b81274
33 changed files with 117 additions and 269 deletions
|
@ -67,8 +67,8 @@ enum {
|
|||
ARM_CP_ALIAS = 1 << 8,
|
||||
/*
|
||||
* Flag: Register does I/O and therefore its accesses need to be marked
|
||||
* with gen_io_start() and also end the TB. In particular, registers which
|
||||
* implement clocks or timers require this.
|
||||
* with translator_io_start() and also end the TB. In particular,
|
||||
* registers which implement clocks or timers require this.
|
||||
*/
|
||||
ARM_CP_IO = 1 << 9,
|
||||
/*
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include "internals.h"
|
||||
#include "qemu/host-utils.h"
|
||||
#include "semihosting/semihost.h"
|
||||
#include "exec/gen-icount.h"
|
||||
#include "exec/log.h"
|
||||
#include "cpregs.h"
|
||||
#include "translate-a64.h"
|
||||
|
@ -1552,9 +1551,7 @@ static bool trans_ERET(DisasContext *s, arg_ERET *a)
|
|||
tcg_gen_ld_i64(dst, cpu_env,
|
||||
offsetof(CPUARMState, elr_el[s->current_el]));
|
||||
|
||||
if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) {
|
||||
gen_io_start();
|
||||
}
|
||||
translator_io_start(&s->base);
|
||||
|
||||
gen_helper_exception_return(cpu_env, dst);
|
||||
/* Must exit loop to check un-masked IRQs */
|
||||
|
@ -1582,9 +1579,8 @@ static bool trans_ERETA(DisasContext *s, arg_reta *a)
|
|||
offsetof(CPUARMState, elr_el[s->current_el]));
|
||||
|
||||
dst = auth_branch_target(s, dst, cpu_X[31], !a->m);
|
||||
if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) {
|
||||
gen_io_start();
|
||||
}
|
||||
|
||||
translator_io_start(&s->base);
|
||||
|
||||
gen_helper_exception_return(cpu_env, dst);
|
||||
/* Must exit loop to check un-masked IRQs */
|
||||
|
@ -2044,6 +2040,7 @@ static void handle_sys(DisasContext *s, uint32_t insn, bool isread,
|
|||
uint32_t key = ENCODE_AA64_CP_REG(CP_REG_ARM64_SYSREG_CP,
|
||||
crn, crm, op0, op1, op2);
|
||||
const ARMCPRegInfo *ri = get_arm_cp_reginfo(s->cp_regs, key);
|
||||
bool need_exit_tb = false;
|
||||
TCGv_ptr tcg_ri = NULL;
|
||||
TCGv_i64 tcg_rt;
|
||||
|
||||
|
@ -2171,8 +2168,9 @@ static void handle_sys(DisasContext *s, uint32_t insn, bool isread,
|
|||
return;
|
||||
}
|
||||
|
||||
if ((tb_cflags(s->base.tb) & CF_USE_ICOUNT) && (ri->type & ARM_CP_IO)) {
|
||||
gen_io_start();
|
||||
if (ri->type & ARM_CP_IO) {
|
||||
/* I/O operations must end the TB here (whether read or write) */
|
||||
need_exit_tb = translator_io_start(&s->base);
|
||||
}
|
||||
|
||||
tcg_rt = cpu_reg(s, rt);
|
||||
|
@ -2202,10 +2200,6 @@ static void handle_sys(DisasContext *s, uint32_t insn, bool isread,
|
|||
}
|
||||
}
|
||||
|
||||
if ((tb_cflags(s->base.tb) & CF_USE_ICOUNT) && (ri->type & ARM_CP_IO)) {
|
||||
/* I/O operations must end the TB here (whether read or write) */
|
||||
s->base.is_jmp = DISAS_UPDATE_EXIT;
|
||||
}
|
||||
if (!isread && !(ri->type & ARM_CP_SUPPRESS_TB_END)) {
|
||||
/*
|
||||
* A write to any coprocessor regiser that ends a TB
|
||||
|
@ -2217,6 +2211,9 @@ static void handle_sys(DisasContext *s, uint32_t insn, bool isread,
|
|||
* but allow this to be suppressed by the register definition
|
||||
* (usually only necessary to work around guest bugs).
|
||||
*/
|
||||
need_exit_tb = true;
|
||||
}
|
||||
if (need_exit_tb) {
|
||||
s->base.is_jmp = DISAS_UPDATE_EXIT;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include "tcg/tcg-op.h"
|
||||
#include "tcg/tcg-op-gvec.h"
|
||||
#include "exec/exec-all.h"
|
||||
#include "exec/gen-icount.h"
|
||||
#include "translate.h"
|
||||
#include "translate-a32.h"
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#include "tcg/tcg-op.h"
|
||||
#include "tcg/tcg-op-gvec.h"
|
||||
#include "exec/exec-all.h"
|
||||
#include "exec/gen-icount.h"
|
||||
#include "translate.h"
|
||||
#include "translate-a32.h"
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#include "tcg/tcg-op.h"
|
||||
#include "tcg/tcg-op-gvec.h"
|
||||
#include "exec/exec-all.h"
|
||||
#include "exec/gen-icount.h"
|
||||
#include "translate.h"
|
||||
#include "translate-a32.h"
|
||||
|
||||
|
@ -117,9 +116,8 @@ static void gen_preserve_fp_state(DisasContext *s, bool skip_context_update)
|
|||
* so we must mark it as an IO operation for icount (and cause
|
||||
* this to be the last insn in the TB).
|
||||
*/
|
||||
if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) {
|
||||
if (translator_io_start(&s->base)) {
|
||||
s->base.is_jmp = DISAS_UPDATE_EXIT;
|
||||
gen_io_start();
|
||||
}
|
||||
gen_helper_v7m_preserve_fp_state(cpu_env);
|
||||
/*
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
#include "cpregs.h"
|
||||
#include "translate.h"
|
||||
#include "translate-a32.h"
|
||||
#include "exec/gen-icount.h"
|
||||
#include "exec/helper-proto.h"
|
||||
|
||||
#define HELPER_H "helper.h"
|
||||
|
@ -2908,9 +2907,7 @@ static void gen_rfe(DisasContext *s, TCGv_i32 pc, TCGv_i32 cpsr)
|
|||
* appropriately depending on the new Thumb bit, so it must
|
||||
* be called after storing the new PC.
|
||||
*/
|
||||
if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) {
|
||||
gen_io_start();
|
||||
}
|
||||
translator_io_start(&s->base);
|
||||
gen_helper_cpsr_write_eret(cpu_env, cpsr);
|
||||
/* Must exit loop to check un-masked IRQs */
|
||||
s->base.is_jmp = DISAS_EXIT;
|
||||
|
@ -4559,7 +4556,7 @@ static void do_coproc_insn(DisasContext *s, int cpnum, int is64,
|
|||
uint32_t key = ENCODE_CP_REG(cpnum, is64, s->ns, crn, crm, opc1, opc2);
|
||||
const ARMCPRegInfo *ri = get_arm_cp_reginfo(s->cp_regs, key);
|
||||
TCGv_ptr tcg_ri = NULL;
|
||||
bool need_exit_tb;
|
||||
bool need_exit_tb = false;
|
||||
uint32_t syndrome;
|
||||
|
||||
/*
|
||||
|
@ -4704,8 +4701,9 @@ static void do_coproc_insn(DisasContext *s, int cpnum, int is64,
|
|||
g_assert_not_reached();
|
||||
}
|
||||
|
||||
if ((tb_cflags(s->base.tb) & CF_USE_ICOUNT) && (ri->type & ARM_CP_IO)) {
|
||||
gen_io_start();
|
||||
if (ri->type & ARM_CP_IO) {
|
||||
/* I/O operations must end the TB here (whether read or write) */
|
||||
need_exit_tb = translator_io_start(&s->base);
|
||||
}
|
||||
|
||||
if (isread) {
|
||||
|
@ -4787,10 +4785,6 @@ static void do_coproc_insn(DisasContext *s, int cpnum, int is64,
|
|||
}
|
||||
}
|
||||
|
||||
/* I/O operations must end the TB here (whether read or write) */
|
||||
need_exit_tb = ((tb_cflags(s->base.tb) & CF_USE_ICOUNT) &&
|
||||
(ri->type & ARM_CP_IO));
|
||||
|
||||
if (!isread && !(ri->type & ARM_CP_SUPPRESS_TB_END)) {
|
||||
/*
|
||||
* A write to any coprocessor register that ends a TB
|
||||
|
@ -8047,9 +8041,7 @@ static bool do_ldm(DisasContext *s, arg_ldst_block *a, int min_n)
|
|||
if (exc_return) {
|
||||
/* Restore CPSR from SPSR. */
|
||||
tmp = load_cpu_field(spsr);
|
||||
if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) {
|
||||
gen_io_start();
|
||||
}
|
||||
translator_io_start(&s->base);
|
||||
gen_helper_cpsr_write_eret(cpu_env, tmp);
|
||||
/* Must exit loop to check un-masked IRQs */
|
||||
s->base.is_jmp = DISAS_EXIT;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue