On 11/18/24 05:32, guoguangyao wrote:
> Add alignment and check for fpr in
> CPUArchState, fix alignment error in
> tcg interpreter when executing LASX.
>
> Signed-off-by: guoguangyao <guoguangyao18@mails.ucas.ac.cn>
> ---
> target/loongarch/cpu.h | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/target/loongarch/cpu.h b/target/loongarch/cpu.h
> index 86c86c6c95..f955f9f618 100644
> --- a/target/loongarch/cpu.h
> +++ b/target/loongarch/cpu.h
> @@ -302,7 +302,7 @@ typedef struct CPUArchState {
> uint64_t gpr[32];
> uint64_t pc;
>
> - fpr_t fpr[32];
> + fpr_t fpr[32] QEMU_ALIGNED(16);
> bool cf[8];
> uint32_t fcsr0;
> lbt_t lbt;
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
> @@ -487,6 +487,7 @@ static inline void cpu_get_tb_cpu_state(CPULoongArchState *env, vaddr *pc,
>
> #define CPU_RESOLVING_TYPE TYPE_LOONGARCH_CPU
>
> +QEMU_BUILD_BUG_ON((offsetof(CPULoongArchState, fpr[0]) & (15)) != 0);
> void loongarch_cpu_post_init(Object *obj);
>
> #endif /* LOONGARCH_CPU_H */