[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 09/17] target/arm: Introduce curr_insn_len
From: |
Richard Henderson |
Subject: |
[PATCH v3 09/17] target/arm: Introduce curr_insn_len |
Date: |
Mon, 22 Aug 2022 16:23:30 -0700 |
A simple helper to retrieve the length of the current insn.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/arm/translate.h | 5 +++++
target/arm/translate-vfp.c | 2 +-
target/arm/translate.c | 5 ++---
3 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/target/arm/translate.h b/target/arm/translate.h
index af5d4a7086..90bf7c57fc 100644
--- a/target/arm/translate.h
+++ b/target/arm/translate.h
@@ -226,6 +226,11 @@ static inline void disas_set_insn_syndrome(DisasContext
*s, uint32_t syn)
s->insn_start = NULL;
}
+static inline int curr_insn_len(DisasContext *s)
+{
+ return s->base.pc_next - s->pc_curr;
+}
+
/* is_jmp field values */
#define DISAS_JUMP DISAS_TARGET_0 /* only pc was modified dynamically */
/* CPU state was modified dynamically; exit to main loop for interrupts. */
diff --git a/target/arm/translate-vfp.c b/target/arm/translate-vfp.c
index bd5ae27d09..94cc1e4b77 100644
--- a/target/arm/translate-vfp.c
+++ b/target/arm/translate-vfp.c
@@ -242,7 +242,7 @@ static bool vfp_access_check_a(DisasContext *s, bool
ignore_vfp_enabled)
if (s->sme_trap_nonstreaming) {
gen_exception_insn(s, s->pc_curr, EXCP_UDEF,
syn_smetrap(SME_ET_Streaming,
- s->base.pc_next - s->pc_curr == 2));
+ curr_insn_len(s) == 2));
return false;
}
diff --git a/target/arm/translate.c b/target/arm/translate.c
index 9474e4b44b..638a051281 100644
--- a/target/arm/translate.c
+++ b/target/arm/translate.c
@@ -6660,7 +6660,7 @@ static ISSInfo make_issinfo(DisasContext *s, int rd, bool
p, bool w)
/* ISS not valid if writeback */
if (p && !w) {
ret = rd;
- if (s->base.pc_next - s->pc_curr == 2) {
+ if (curr_insn_len(s) == 2) {
ret |= ISSIs16Bit;
}
} else {
@@ -9825,8 +9825,7 @@ static void arm_tr_tb_stop(DisasContextBase *dcbase,
CPUState *cpu)
/* nothing more to generate */
break;
case DISAS_WFI:
- gen_helper_wfi(cpu_env,
- tcg_constant_i32(dc->base.pc_next - dc->pc_curr));
+ gen_helper_wfi(cpu_env, tcg_constant_i32(curr_insn_len(dc)));
/*
* The helper doesn't necessarily throw an exception, but we
* must go back to the main loop to check for interrupts anyway.
--
2.34.1
- [PATCH v3 04/17] accel/tcg: Do not align tb->page_addr[0], (continued)
- [PATCH v3 04/17] accel/tcg: Do not align tb->page_addr[0], Richard Henderson, 2022/08/22
- [PATCH v3 02/17] accel/tcg: Use bool for page_find_alloc, Richard Henderson, 2022/08/22
- [PATCH v3 05/17] include/hw/core: Create struct CPUJumpCache, Richard Henderson, 2022/08/22
- [PATCH v3 13/17] target/arm: Change gen_exception_internal to work on displacements, Richard Henderson, 2022/08/22
- [PATCH v3 14/17] target/arm: Change gen_jmp* to work on displacements, Richard Henderson, 2022/08/22
- [PATCH v3 11/17] target/arm: Change gen_*set_pc_im to gen_*update_pc, Richard Henderson, 2022/08/22
- [PATCH v3 15/17] target/arm: Introduce gen_pc_plus_diff for aarch64, Richard Henderson, 2022/08/22
- [PATCH v3 07/17] accel/tcg: Introduce TARGET_TB_PCREL, Richard Henderson, 2022/08/22
- [PATCH v3 08/17] accel/tcg: Split log_cpu_exec into inline and slow path, Richard Henderson, 2022/08/22
- [PATCH v3 12/17] target/arm: Change gen_exception_insn* to work on displacements, Richard Henderson, 2022/08/22
- [PATCH v3 09/17] target/arm: Introduce curr_insn_len,
Richard Henderson <=
- [PATCH v3 06/17] accel/tcg: Introduce tb_pc and tb_pc_log, Richard Henderson, 2022/08/22
- [PATCH v3 10/17] target/arm: Change gen_goto_tb to work on displacements, Richard Henderson, 2022/08/22
- [PATCH v3 16/17] target/arm: Introduce gen_pc_plus_diff for aarch32, Richard Henderson, 2022/08/22
- [PATCH v3 17/17] target/arm: Enable TARGET_TB_PCREL, Richard Henderson, 2022/08/22