target/openrisc: Use env_cpu, env_archcpu

Cleanup in the boilerplate that each target must define.
Replace openrisc_env_get_cpu with env_archcpu.  The combination
CPU(openrisc_env_get_cpu) should have used ENV_GET_CPU to begin;
use env_cpu now.

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson 2019-03-22 18:48:56 -07:00
parent 29168c6585
commit 5ee2b02e92
4 changed files with 7 additions and 13 deletions

View file

@ -23,7 +23,7 @@
void cpu_loop(CPUOpenRISCState *env) void cpu_loop(CPUOpenRISCState *env)
{ {
CPUState *cs = CPU(openrisc_env_get_cpu(env)); CPUState *cs = env_cpu(env);
int trapnr; int trapnr;
abi_long ret; abi_long ret;
target_siginfo_t info; target_siginfo_t info;

View file

@ -317,11 +317,6 @@ typedef struct OpenRISCCPU {
} OpenRISCCPU; } OpenRISCCPU;
static inline OpenRISCCPU *openrisc_env_get_cpu(CPUOpenRISCState *env)
{
return container_of(env, OpenRISCCPU, env);
}
#define ENV_OFFSET offsetof(OpenRISCCPU, env) #define ENV_OFFSET offsetof(OpenRISCCPU, env)
void cpu_openrisc_list(void); void cpu_openrisc_list(void);

View file

@ -25,15 +25,14 @@
void HELPER(exception)(CPUOpenRISCState *env, uint32_t excp) void HELPER(exception)(CPUOpenRISCState *env, uint32_t excp)
{ {
OpenRISCCPU *cpu = openrisc_env_get_cpu(env); OpenRISCCPU *cpu = env_archcpu(env);
raise_exception(cpu, excp); raise_exception(cpu, excp);
} }
static void QEMU_NORETURN do_range(CPUOpenRISCState *env, uintptr_t pc) static void QEMU_NORETURN do_range(CPUOpenRISCState *env, uintptr_t pc)
{ {
OpenRISCCPU *cpu = openrisc_env_get_cpu(env); CPUState *cs = env_cpu(env);
CPUState *cs = CPU(cpu);
cs->exception_index = EXCP_RANGE; cs->exception_index = EXCP_RANGE;
cpu_loop_exit_restore(cs, pc); cpu_loop_exit_restore(cs, pc);

View file

@ -30,8 +30,8 @@
void HELPER(mtspr)(CPUOpenRISCState *env, target_ulong spr, target_ulong rb) void HELPER(mtspr)(CPUOpenRISCState *env, target_ulong spr, target_ulong rb)
{ {
#ifndef CONFIG_USER_ONLY #ifndef CONFIG_USER_ONLY
OpenRISCCPU *cpu = openrisc_env_get_cpu(env); OpenRISCCPU *cpu = env_archcpu(env);
CPUState *cs = CPU(cpu); CPUState *cs = env_cpu(env);
target_ulong mr; target_ulong mr;
int idx; int idx;
@ -194,8 +194,8 @@ target_ulong HELPER(mfspr)(CPUOpenRISCState *env, target_ulong rd,
target_ulong spr) target_ulong spr)
{ {
#ifndef CONFIG_USER_ONLY #ifndef CONFIG_USER_ONLY
OpenRISCCPU *cpu = openrisc_env_get_cpu(env); OpenRISCCPU *cpu = env_archcpu(env);
CPUState *cs = CPU(cpu); CPUState *cs = env_cpu(env);
int idx; int idx;
switch (spr) { switch (spr) {