[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 14/36] target/mips: Declare mips_env_set_pc() inlined in "internal
From: |
Philippe Mathieu-Daudé |
Subject: |
[PULL 14/36] target/mips: Declare mips_env_set_pc() inlined in "internal.h" |
Date: |
Sun, 2 May 2021 18:15:16 +0200 |
Rename set_pc() as mips_env_set_pc(), declare it inlined
and use it in cpu.c and op_helper.c.
Reported-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20210428170410.479308-9-f4bug@amsat.org>
---
target/mips/internal.h | 10 ++++++++++
target/mips/cpu.c | 8 +-------
target/mips/op_helper.c | 16 +++-------------
3 files changed, 14 insertions(+), 20 deletions(-)
diff --git a/target/mips/internal.h b/target/mips/internal.h
index 57072a941e7..04f4b3d6614 100644
--- a/target/mips/internal.h
+++ b/target/mips/internal.h
@@ -219,6 +219,16 @@ bool mips_cpu_tlb_fill(CPUState *cs, vaddr address, int
size,
/* op_helper.c */
void update_pagemask(CPUMIPSState *env, target_ulong arg1, int32_t *pagemask);
+static inline void mips_env_set_pc(CPUMIPSState *env, target_ulong value)
+{
+ env->active_tc.PC = value & ~(target_ulong)1;
+ if (value & 1) {
+ env->hflags |= MIPS_HFLAG_M16;
+ } else {
+ env->hflags &= ~(MIPS_HFLAG_M16);
+ }
+}
+
static inline void restore_pamask(CPUMIPSState *env)
{
if (env->hflags & MIPS_HFLAG_ELPA) {
diff --git a/target/mips/cpu.c b/target/mips/cpu.c
index 8f76f4576f4..a751c958329 100644
--- a/target/mips/cpu.c
+++ b/target/mips/cpu.c
@@ -327,14 +327,8 @@ void QEMU_NORETURN do_raise_exception_err(CPUMIPSState
*env,
static void mips_cpu_set_pc(CPUState *cs, vaddr value)
{
MIPSCPU *cpu = MIPS_CPU(cs);
- CPUMIPSState *env = &cpu->env;
- env->active_tc.PC = value & ~(target_ulong)1;
- if (value & 1) {
- env->hflags |= MIPS_HFLAG_M16;
- } else {
- env->hflags &= ~(MIPS_HFLAG_M16);
- }
+ mips_env_set_pc(&cpu->env, value);
}
#ifdef CONFIG_TCG
diff --git a/target/mips/op_helper.c b/target/mips/op_helper.c
index b80e8f75401..222a0d7c7b3 100644
--- a/target/mips/op_helper.c
+++ b/target/mips/op_helper.c
@@ -993,24 +993,14 @@ static void debug_post_eret(CPUMIPSState *env)
}
}
-static void set_pc(CPUMIPSState *env, target_ulong error_pc)
-{
- env->active_tc.PC = error_pc & ~(target_ulong)1;
- if (error_pc & 1) {
- env->hflags |= MIPS_HFLAG_M16;
- } else {
- env->hflags &= ~(MIPS_HFLAG_M16);
- }
-}
-
static inline void exception_return(CPUMIPSState *env)
{
debug_pre_eret(env);
if (env->CP0_Status & (1 << CP0St_ERL)) {
- set_pc(env, env->CP0_ErrorEPC);
+ mips_env_set_pc(env, env->CP0_ErrorEPC);
env->CP0_Status &= ~(1 << CP0St_ERL);
} else {
- set_pc(env, env->CP0_EPC);
+ mips_env_set_pc(env, env->CP0_EPC);
env->CP0_Status &= ~(1 << CP0St_EXL);
}
compute_hflags(env);
@@ -1036,7 +1026,7 @@ void helper_deret(CPUMIPSState *env)
env->hflags &= ~MIPS_HFLAG_DM;
compute_hflags(env);
- set_pc(env, env->CP0_DEPC);
+ mips_env_set_pc(env, env->CP0_DEPC);
debug_post_eret(env);
}
--
2.26.3
- [PULL 04/36] target/mips: Remove spurious LOG_UNIMP of MTHC0 opcode, (continued)
- [PULL 04/36] target/mips: Remove spurious LOG_UNIMP of MTHC0 opcode, Philippe Mathieu-Daudé, 2021/05/02
- [PULL 05/36] target/mips: Migrate missing CPU fields, Philippe Mathieu-Daudé, 2021/05/02
- [PULL 06/36] target/mips: Make check_cp0_enabled() return a boolean, Philippe Mathieu-Daudé, 2021/05/02
- [PULL 07/36] target/mips: Simplify meson TCG rules, Philippe Mathieu-Daudé, 2021/05/02
- [PULL 08/36] target/mips: Move IEEE rounding mode array to new source file, Philippe Mathieu-Daudé, 2021/05/02
- [PULL 09/36] target/mips: Move msa_reset() to new source file, Philippe Mathieu-Daudé, 2021/05/02
- [PULL 10/36] target/mips: Make CPU/FPU regnames[] arrays global, Philippe Mathieu-Daudé, 2021/05/02
- [PULL 11/36] target/mips: Optimize CPU/FPU regnames[] arrays, Philippe Mathieu-Daudé, 2021/05/02
- [PULL 12/36] target/mips: Restrict mips_cpu_dump_state() to cpu.c, Philippe Mathieu-Daudé, 2021/05/02
- [PULL 13/36] target/mips: Turn printfpr() macro into a proper function, Philippe Mathieu-Daudé, 2021/05/02
- [PULL 14/36] target/mips: Declare mips_env_set_pc() inlined in "internal.h",
Philippe Mathieu-Daudé <=
- [PULL 15/36] target/mips: Merge do_translate_address into cpu_mips_translate_address, Philippe Mathieu-Daudé, 2021/05/02
- [PULL 16/36] target/mips: Extract load/store helpers to ldst_helper.c, Philippe Mathieu-Daudé, 2021/05/02
- [PULL 17/36] meson: Introduce meson_user_arch source set for arch-specific user-mode, Philippe Mathieu-Daudé, 2021/05/02
- [PULL 18/36] target/mips: Introduce tcg-internal.h for TCG specific declarations, Philippe Mathieu-Daudé, 2021/05/02
- [PULL 19/36] target/mips: Add simple user-mode mips_cpu_do_interrupt(), Philippe Mathieu-Daudé, 2021/05/02
- [PULL 20/36] target/mips: Add simple user-mode mips_cpu_tlb_fill(), Philippe Mathieu-Daudé, 2021/05/02
- [PULL 21/36] target/mips: Move cpu_signal_handler definition around, Philippe Mathieu-Daudé, 2021/05/02
- [PULL 22/36] target/mips: Move sysemu specific files under sysemu/ subfolder, Philippe Mathieu-Daudé, 2021/05/02
- [PULL 23/36] target/mips: Move physical addressing code to sysemu/physaddr.c, Philippe Mathieu-Daudé, 2021/05/02
- [PULL 24/36] target/mips: Restrict cpu_mips_get_random() / update_pagemask() to TCG, Philippe Mathieu-Daudé, 2021/05/02