[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH for-4.1 v2 13/36] target/lm32: Use env_cpu, env_arch
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [PATCH for-4.1 v2 13/36] target/lm32: Use env_cpu, env_archcpu |
Date: |
Thu, 28 Mar 2019 13:03:41 -1000 |
Signed-off-by: Richard Henderson <address@hidden>
---
target/lm32/cpu.h | 5 -----
target/lm32/helper.c | 19 ++++++-------------
target/lm32/op_helper.c | 6 +++---
target/lm32/translate.c | 2 +-
4 files changed, 10 insertions(+), 22 deletions(-)
diff --git a/target/lm32/cpu.h b/target/lm32/cpu.h
index 258f2b4266..69beb16972 100644
--- a/target/lm32/cpu.h
+++ b/target/lm32/cpu.h
@@ -195,11 +195,6 @@ struct LM32CPU {
uint32_t features;
};
-static inline LM32CPU *lm32_env_get_cpu(CPULM32State *env)
-{
- return container_of(env, LM32CPU, env);
-}
-
#define ENV_OFFSET offsetof(LM32CPU, env)
#ifndef CONFIG_USER_ONLY
diff --git a/target/lm32/helper.c b/target/lm32/helper.c
index a039a993ff..674cbd7fe4 100644
--- a/target/lm32/helper.c
+++ b/target/lm32/helper.c
@@ -58,28 +58,23 @@ hwaddr lm32_cpu_get_phys_page_debug(CPUState *cs, vaddr
addr)
void lm32_breakpoint_insert(CPULM32State *env, int idx, target_ulong address)
{
- LM32CPU *cpu = lm32_env_get_cpu(env);
-
- cpu_breakpoint_insert(CPU(cpu), address, BP_CPU,
+ cpu_breakpoint_insert(env_cpu(env), address, BP_CPU,
&env->cpu_breakpoint[idx]);
}
void lm32_breakpoint_remove(CPULM32State *env, int idx)
{
- LM32CPU *cpu = lm32_env_get_cpu(env);
-
if (!env->cpu_breakpoint[idx]) {
return;
}
- cpu_breakpoint_remove_by_ref(CPU(cpu), env->cpu_breakpoint[idx]);
+ cpu_breakpoint_remove_by_ref(env_cpu(env), env->cpu_breakpoint[idx]);
env->cpu_breakpoint[idx] = NULL;
}
void lm32_watchpoint_insert(CPULM32State *env, int idx, target_ulong address,
lm32_wp_t wp_type)
{
- LM32CPU *cpu = lm32_env_get_cpu(env);
int flags = 0;
switch (wp_type) {
@@ -98,26 +93,24 @@ void lm32_watchpoint_insert(CPULM32State *env, int idx,
target_ulong address,
}
if (flags != 0) {
- cpu_watchpoint_insert(CPU(cpu), address, 1, flags,
- &env->cpu_watchpoint[idx]);
+ cpu_watchpoint_insert(env_cpu(env), address, 1, flags,
+ &env->cpu_watchpoint[idx]);
}
}
void lm32_watchpoint_remove(CPULM32State *env, int idx)
{
- LM32CPU *cpu = lm32_env_get_cpu(env);
-
if (!env->cpu_watchpoint[idx]) {
return;
}
- cpu_watchpoint_remove_by_ref(CPU(cpu), env->cpu_watchpoint[idx]);
+ cpu_watchpoint_remove_by_ref(env_cpu(env), env->cpu_watchpoint[idx]);
env->cpu_watchpoint[idx] = NULL;
}
static bool check_watchpoints(CPULM32State *env)
{
- LM32CPU *cpu = lm32_env_get_cpu(env);
+ LM32CPU *cpu = env_archcpu(env);
int i;
for (i = 0; i < cpu->num_watchpoints; i++) {
diff --git a/target/lm32/op_helper.c b/target/lm32/op_helper.c
index 234d55e056..ebff4c4518 100644
--- a/target/lm32/op_helper.c
+++ b/target/lm32/op_helper.c
@@ -16,7 +16,7 @@
#if !defined(CONFIG_USER_ONLY)
void raise_exception(CPULM32State *env, int index)
{
- CPUState *cs = CPU(lm32_env_get_cpu(env));
+ CPUState *cs = env_cpu(env);
cs->exception_index = index;
cpu_loop_exit(cs);
@@ -29,7 +29,7 @@ void HELPER(raise_exception)(CPULM32State *env, uint32_t
index)
void HELPER(hlt)(CPULM32State *env)
{
- CPUState *cs = CPU(lm32_env_get_cpu(env));
+ CPUState *cs = env_cpu(env);
cs->halted = 1;
cs->exception_index = EXCP_HLT;
@@ -39,7 +39,7 @@ void HELPER(hlt)(CPULM32State *env)
void HELPER(ill)(CPULM32State *env)
{
#ifndef CONFIG_USER_ONLY
- CPUState *cs = CPU(lm32_env_get_cpu(env));
+ CPUState *cs = env_cpu(env);
fprintf(stderr, "VM paused due to illegal instruction. "
"Connect a debugger or switch to the monitor console "
"to find out more.\n");
diff --git a/target/lm32/translate.c b/target/lm32/translate.c
index b32feb7564..e2163809f2 100644
--- a/target/lm32/translate.c
+++ b/target/lm32/translate.c
@@ -1052,7 +1052,7 @@ static inline void decode(DisasContext *dc, uint32_t ir)
void gen_intermediate_code(CPUState *cs, struct TranslationBlock *tb)
{
CPULM32State *env = cs->env_ptr;
- LM32CPU *cpu = lm32_env_get_cpu(env);
+ LM32CPU *cpu = env_archcpu(env);
struct DisasContext ctx, *dc = &ctx;
uint32_t pc_start;
uint32_t page_start;
--
2.17.1
- [Qemu-devel] [PATCH for-4.1 v2 28/36] target/xtensa: Use env_cpu, env_archcpu, (continued)
- [Qemu-devel] [PATCH for-4.1 v2 28/36] target/xtensa: Use env_cpu, env_archcpu, Richard Henderson, 2019/03/28
- [Qemu-devel] [PATCH for-4.1 v2 18/36] target/nios2: Use env_cpu, env_archcpu, Richard Henderson, 2019/03/28
- [Qemu-devel] [PATCH for-4.1 v2 31/36] cpu: Introduce CPUNegativeOffsetState, Richard Henderson, 2019/03/28
- [Qemu-devel] [PATCH for-4.1 v2 26/36] target/tricore: Use env_cpu, Richard Henderson, 2019/03/28
- [Qemu-devel] [PATCH for-4.1 v2 32/36] cpu: Move icount_decr to CPUNegativeOffsetState, Richard Henderson, 2019/03/28
- [Qemu-devel] [PATCH for-4.1 v2 21/36] target/riscv: Use env_cpu, env_archcpu, Richard Henderson, 2019/03/28
- [Qemu-devel] [PATCH for-4.1 v2 22/36] target/s390x: Use env_cpu, env_archcpu, Richard Henderson, 2019/03/28
- [Qemu-devel] [PATCH for-4.1 v2 17/36] target/moxie: Use env_cpu, env_archcpu, Richard Henderson, 2019/03/28
- [Qemu-devel] [PATCH for-4.1 v2 20/36] target/ppc: Use env_cpu, env_archcpu, Richard Henderson, 2019/03/28
- [Qemu-devel] [PATCH for-4.1 v2 14/36] target/m68k: Use env_cpu, env_archcpu, Richard Henderson, 2019/03/28
- [Qemu-devel] [PATCH for-4.1 v2 13/36] target/lm32: Use env_cpu, env_archcpu,
Richard Henderson <=
- [Qemu-devel] [PATCH for-4.1 v2 10/36] target/cris: Use env_cpu, env_archcpu, Richard Henderson, 2019/03/28
- [Qemu-devel] [PATCH for-4.1 v2 25/36] target/tilegx: Use env_cpu, Richard Henderson, 2019/03/28
- [Qemu-devel] [PATCH for-4.1 v2 27/36] target/unicore32: Use env_cpu, env_archcpu, Richard Henderson, 2019/03/28
- [Qemu-devel] [PATCH for-4.1 v2 12/36] target/i386: Use env_cpu, env_archcpu, Richard Henderson, 2019/03/28
- [Qemu-devel] [PATCH for-4.1 v2 08/36] target/alpha: Use env_cpu, env_archcpu, Richard Henderson, 2019/03/28
- [Qemu-devel] [PATCH for-4.1 v2 15/36] target/microblaze: Use env_cpu, env_archcpu, Richard Henderson, 2019/03/28
- [Qemu-devel] [PATCH for-4.1 v2 02/36] tcg: Split out target/arch/cpu-param.h, Richard Henderson, 2019/03/28
- [Qemu-devel] [PATCH for-4.1 v2 04/36] cpu: Define CPUArchState with typedef, Richard Henderson, 2019/03/28
- [Qemu-devel] [PATCH for-4.1 v2 16/36] target/mips: Use env_cpu, env_archcpu, Richard Henderson, 2019/03/28
- [Qemu-devel] [PATCH for-4.1 v2 11/36] target/hppa: Use env_cpu, env_archcpu, Richard Henderson, 2019/03/28