Re: [Qemu-devel] [PATCH 06/35] cpu: Replace ENV_GET_CPU with env_cpu

2019-03-26 Thread Alistair Francis
On Sat, Mar 23, 2019 at 12:52 PM Richard Henderson
 wrote:
>
> Now that we have both ArchCPU and CPUArchState, we can define
> this generically instead of via macro in each target's cpu.h.
>
> Signed-off-by: Richard Henderson 

Acked-by: Alistair Francis 

Alistair

> ---
>  accel/tcg/atomic_template.h   |  8 ++--
>  accel/tcg/softmmu_template.h  | 20 +-
>  include/exec/cpu-all.h| 12 ++
>  include/exec/cpu_ldst_template.h  |  6 +--
>  include/exec/cpu_ldst_useronly_template.h |  6 +--
>  include/exec/softmmu-semi.h   | 16 
>  linux-user/cpu_loop-common.h  |  2 +-
>  target/alpha/cpu.h|  2 -
>  target/arm/cpu.h  |  2 -
>  target/cris/cpu.h |  2 -
>  target/hppa/cpu.h |  1 -
>  target/i386/cpu.h |  2 -
>  target/lm32/cpu.h |  2 -
>  target/m68k/cpu.h |  2 -
>  target/microblaze/cpu.h   |  2 -
>  target/mips/cpu.h |  2 -
>  target/moxie/cpu.h|  2 -
>  target/nios2/cpu.h|  2 -
>  target/openrisc/cpu.h |  2 -
>  target/ppc/cpu.h  |  2 -
>  target/riscv/cpu.h|  1 -
>  target/s390x/cpu.h|  2 -
>  target/sh4/cpu.h  |  2 -
>  target/sparc/cpu.h|  2 -
>  target/tilegx/cpu.h   |  2 -
>  target/tricore/cpu.h  |  2 -
>  target/unicore32/cpu.h|  2 -
>  target/xtensa/cpu.h   |  2 -
>  accel/tcg/cputlb.c| 22 +--
>  accel/tcg/tcg-runtime.c   |  4 +-
>  accel/tcg/translate-all.c |  2 +-
>  accel/tcg/user-exec.c |  2 +-
>  bsd-user/syscall.c|  6 +--
>  linux-user/arm/cpu_loop.c |  2 +-
>  linux-user/cris/cpu_loop.c|  2 +-
>  linux-user/elfload.c  |  6 +--
>  linux-user/m68k/cpu_loop.c|  2 +-
>  linux-user/main.c |  2 +-
>  linux-user/mips/cpu_loop.c|  2 +-
>  linux-user/nios2/cpu_loop.c   |  2 +-
>  linux-user/riscv/cpu_loop.c   |  2 +-
>  linux-user/signal.c   |  8 ++--
>  linux-user/syscall.c  | 18 -
>  linux-user/uname.c|  2 +-
>  target/arm/helper.c   | 42 ++--
>  target/hppa/op_helper.c   |  2 +-
>  target/i386/hax-all.c |  6 +--
>  target/i386/hvf/x86_decode.c  | 22 +--
>  target/i386/hvf/x86_emu.c | 48 +++
>  target/i386/mem_helper.c  |  4 +-
>  target/m68k/op_helper.c   |  2 +-
>  target/nios2/mmu.c|  4 +-
>  target/nios2/op_helper.c  |  2 +-
>  target/ppc/mmu_helper.c   |  2 +-
>  target/s390x/gdbstub.c| 24 ++--
>  target/s390x/mem_helper.c |  2 +-
>  target/sh4/op_helper.c|  2 +-
>  docs/devel/tracing.txt|  4 +-
>  scripts/tracetool/format/tcg_helper_c.py  |  2 +-
>  59 files changed, 167 insertions(+), 195 deletions(-)
>
> diff --git a/accel/tcg/atomic_template.h b/accel/tcg/atomic_template.h
> index 685602b076..5aaf186253 100644
> --- a/accel/tcg/atomic_template.h
> +++ b/accel/tcg/atomic_template.h
> @@ -62,21 +62,21 @@
>  #define ATOMIC_TRACE_RMW do {   \
>  uint8_t info = glue(trace_mem_build_info_no_se, MEND)(SHIFT, false); 
> \
>  \
> -trace_guest_mem_before_exec(ENV_GET_CPU(env), addr, info);  \
> -trace_guest_mem_before_exec(ENV_GET_CPU(env), addr, \
> +trace_guest_mem_before_exec(env_cpu(env), addr, info);  \
> +trace_guest_mem_before_exec(env_cpu(env), addr, \
>  info | TRACE_MEM_ST);   \
>  } while (0)
>
>  #define ATOMIC_TRACE_LD do {\
>  uint8_t info = glue(trace_mem_build_info_no_se, MEND)(SHIFT, false); 
> \
>  \
> -trace_guest_mem_before_exec(ENV_GET_CPU(env), addr, info);  \
> +trace_guest_mem_before_exec(env_cpu(env), addr, info);  \
>  } while (0)
>
>  # define ATOMIC_TRACE_ST do {   \
>  uint8_t info = glue(trace_mem_build_info_no_se, MEND)(SHIFT, true); \
> 

[Qemu-devel] [PATCH 06/35] cpu: Replace ENV_GET_CPU with env_cpu

2019-03-23 Thread Richard Henderson
Now that we have both ArchCPU and CPUArchState, we can define
this generically instead of via macro in each target's cpu.h.

Signed-off-by: Richard Henderson 
---
 accel/tcg/atomic_template.h   |  8 ++--
 accel/tcg/softmmu_template.h  | 20 +-
 include/exec/cpu-all.h| 12 ++
 include/exec/cpu_ldst_template.h  |  6 +--
 include/exec/cpu_ldst_useronly_template.h |  6 +--
 include/exec/softmmu-semi.h   | 16 
 linux-user/cpu_loop-common.h  |  2 +-
 target/alpha/cpu.h|  2 -
 target/arm/cpu.h  |  2 -
 target/cris/cpu.h |  2 -
 target/hppa/cpu.h |  1 -
 target/i386/cpu.h |  2 -
 target/lm32/cpu.h |  2 -
 target/m68k/cpu.h |  2 -
 target/microblaze/cpu.h   |  2 -
 target/mips/cpu.h |  2 -
 target/moxie/cpu.h|  2 -
 target/nios2/cpu.h|  2 -
 target/openrisc/cpu.h |  2 -
 target/ppc/cpu.h  |  2 -
 target/riscv/cpu.h|  1 -
 target/s390x/cpu.h|  2 -
 target/sh4/cpu.h  |  2 -
 target/sparc/cpu.h|  2 -
 target/tilegx/cpu.h   |  2 -
 target/tricore/cpu.h  |  2 -
 target/unicore32/cpu.h|  2 -
 target/xtensa/cpu.h   |  2 -
 accel/tcg/cputlb.c| 22 +--
 accel/tcg/tcg-runtime.c   |  4 +-
 accel/tcg/translate-all.c |  2 +-
 accel/tcg/user-exec.c |  2 +-
 bsd-user/syscall.c|  6 +--
 linux-user/arm/cpu_loop.c |  2 +-
 linux-user/cris/cpu_loop.c|  2 +-
 linux-user/elfload.c  |  6 +--
 linux-user/m68k/cpu_loop.c|  2 +-
 linux-user/main.c |  2 +-
 linux-user/mips/cpu_loop.c|  2 +-
 linux-user/nios2/cpu_loop.c   |  2 +-
 linux-user/riscv/cpu_loop.c   |  2 +-
 linux-user/signal.c   |  8 ++--
 linux-user/syscall.c  | 18 -
 linux-user/uname.c|  2 +-
 target/arm/helper.c   | 42 ++--
 target/hppa/op_helper.c   |  2 +-
 target/i386/hax-all.c |  6 +--
 target/i386/hvf/x86_decode.c  | 22 +--
 target/i386/hvf/x86_emu.c | 48 +++
 target/i386/mem_helper.c  |  4 +-
 target/m68k/op_helper.c   |  2 +-
 target/nios2/mmu.c|  4 +-
 target/nios2/op_helper.c  |  2 +-
 target/ppc/mmu_helper.c   |  2 +-
 target/s390x/gdbstub.c| 24 ++--
 target/s390x/mem_helper.c |  2 +-
 target/sh4/op_helper.c|  2 +-
 docs/devel/tracing.txt|  4 +-
 scripts/tracetool/format/tcg_helper_c.py  |  2 +-
 59 files changed, 167 insertions(+), 195 deletions(-)

diff --git a/accel/tcg/atomic_template.h b/accel/tcg/atomic_template.h
index 685602b076..5aaf186253 100644
--- a/accel/tcg/atomic_template.h
+++ b/accel/tcg/atomic_template.h
@@ -62,21 +62,21 @@
 #define ATOMIC_TRACE_RMW do {   \
 uint8_t info = glue(trace_mem_build_info_no_se, MEND)(SHIFT, false); \
 \
-trace_guest_mem_before_exec(ENV_GET_CPU(env), addr, info);  \
-trace_guest_mem_before_exec(ENV_GET_CPU(env), addr, \
+trace_guest_mem_before_exec(env_cpu(env), addr, info);  \
+trace_guest_mem_before_exec(env_cpu(env), addr, \
 info | TRACE_MEM_ST);   \
 } while (0)
 
 #define ATOMIC_TRACE_LD do {\
 uint8_t info = glue(trace_mem_build_info_no_se, MEND)(SHIFT, false); \
 \
-trace_guest_mem_before_exec(ENV_GET_CPU(env), addr, info);  \
+trace_guest_mem_before_exec(env_cpu(env), addr, info);  \
 } while (0)
 
 # define ATOMIC_TRACE_ST do {   \
 uint8_t info = glue(trace_mem_build_info_no_se, MEND)(SHIFT, true); \
 \
-trace_guest_mem_before_exec(ENV_GET_CPU(env), addr, info);  \
+trace_guest_mem_before_exec(env_cpu(env), addr, info);  \
 } while (0)
 
 /* Define host-endian atomic operations.  Note that END is used within
diff --git