qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

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>

+7 -13
+1 -1
linux-user/openrisc/cpu_loop.c
··· 23 23 24 24 void cpu_loop(CPUOpenRISCState *env) 25 25 { 26 - CPUState *cs = CPU(openrisc_env_get_cpu(env)); 26 + CPUState *cs = env_cpu(env); 27 27 int trapnr; 28 28 abi_long ret; 29 29 target_siginfo_t info;
-5
target/openrisc/cpu.h
··· 317 317 318 318 } OpenRISCCPU; 319 319 320 - static inline OpenRISCCPU *openrisc_env_get_cpu(CPUOpenRISCState *env) 321 - { 322 - return container_of(env, OpenRISCCPU, env); 323 - } 324 - 325 320 #define ENV_OFFSET offsetof(OpenRISCCPU, env) 326 321 327 322 void cpu_openrisc_list(void);
+2 -3
target/openrisc/exception_helper.c
··· 25 25 26 26 void HELPER(exception)(CPUOpenRISCState *env, uint32_t excp) 27 27 { 28 - OpenRISCCPU *cpu = openrisc_env_get_cpu(env); 28 + OpenRISCCPU *cpu = env_archcpu(env); 29 29 30 30 raise_exception(cpu, excp); 31 31 } 32 32 33 33 static void QEMU_NORETURN do_range(CPUOpenRISCState *env, uintptr_t pc) 34 34 { 35 - OpenRISCCPU *cpu = openrisc_env_get_cpu(env); 36 - CPUState *cs = CPU(cpu); 35 + CPUState *cs = env_cpu(env); 37 36 38 37 cs->exception_index = EXCP_RANGE; 39 38 cpu_loop_exit_restore(cs, pc);
+4 -4
target/openrisc/sys_helper.c
··· 30 30 void HELPER(mtspr)(CPUOpenRISCState *env, target_ulong spr, target_ulong rb) 31 31 { 32 32 #ifndef CONFIG_USER_ONLY 33 - OpenRISCCPU *cpu = openrisc_env_get_cpu(env); 34 - CPUState *cs = CPU(cpu); 33 + OpenRISCCPU *cpu = env_archcpu(env); 34 + CPUState *cs = env_cpu(env); 35 35 target_ulong mr; 36 36 int idx; 37 37 ··· 194 194 target_ulong spr) 195 195 { 196 196 #ifndef CONFIG_USER_ONLY 197 - OpenRISCCPU *cpu = openrisc_env_get_cpu(env); 198 - CPUState *cs = CPU(cpu); 197 + OpenRISCCPU *cpu = env_archcpu(env); 198 + CPUState *cs = env_cpu(env); 199 199 int idx; 200 200 201 201 switch (spr) {