[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 07/60] target/arm: Extend store_cpu_offset to take field s
From: |
Peter Maydell |
Subject: |
Re: [PATCH v3 07/60] target/arm: Extend store_cpu_offset to take field size |
Date: |
Thu, 21 Apr 2022 17:15:08 +0100 |
On Sun, 17 Apr 2022 at 18:50, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> Currently we assume all fields are 32-bit.
> Prepare for fields of a single byte, using sizeof.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> target/arm/translate-a32.h | 13 +++++--------
> target/arm/translate.c | 21 ++++++++++++++++++++-
> 2 files changed, 25 insertions(+), 9 deletions(-)
>
> diff --git a/target/arm/translate-a32.h b/target/arm/translate-a32.h
> index 5be4b9b834..f593740a88 100644
> --- a/target/arm/translate-a32.h
> +++ b/target/arm/translate-a32.h
> @@ -61,17 +61,14 @@ static inline TCGv_i32 load_cpu_offset(int offset)
>
> #define load_cpu_field(name) load_cpu_offset(offsetof(CPUARMState, name))
>
> -static inline void store_cpu_offset(TCGv_i32 var, int offset)
> -{
> - tcg_gen_st_i32(var, cpu_env, offset);
> - tcg_temp_free_i32(var);
> -}
> +void store_cpu_offset(TCGv_i32 var, int offset, int size);
>
> -#define store_cpu_field(var, name) \
> - store_cpu_offset(var, offsetof(CPUARMState, name))
> +#define store_cpu_field(var, name) \
> + store_cpu_offset(var, offsetof(CPUARMState, name), \
> + sizeof(((CPUARMState *)NULL)->name))
compiler.h defines sizeof_field, so you can write
sizeof_field(CPUARMState, name)
here.
Otherwise
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
thanks
-- PMM
- Re: [PATCH v3 08/60] target/arm: Change DisasContext.thumb to bool, (continued)
- [PATCH v3 09/60] target/arm: Change CPUArchState.thumb to bool, Richard Henderson, 2022/04/17
- [PATCH v3 19/60] target/arm: Use tcg_constant in translate-neon.c, Richard Henderson, 2022/04/17
- [PATCH v3 16/60] target/arm: Simplify aa32 DISAS_WFI, Richard Henderson, 2022/04/17
- [PATCH v3 15/60] target/arm: Simplify gen_sar, Richard Henderson, 2022/04/17
- [PATCH v3 07/60] target/arm: Extend store_cpu_offset to take field size, Richard Henderson, 2022/04/17
- [PATCH v3 11/60] target/arm: Split out set_btype_raw, Richard Henderson, 2022/04/17
- [PATCH v3 14/60] target/arm: Simplify GEN_SHIFT in translate.c, Richard Henderson, 2022/04/17
- [PATCH v3 10/60] target/arm: Remove fpexc32_access, Richard Henderson, 2022/04/17
- [PATCH v3 12/60] target/arm: Split out gen_rebuild_hflags, Richard Henderson, 2022/04/17
- [PATCH v3 13/60] target/arm: Use tcg_constant in translate-a64.c, Richard Henderson, 2022/04/17