diff mbox series

target/loongarch: fix alignment error in tci.

Message ID 20241118133243.291769-1-guoguangyao18@mails.ucas.ac.cn (mailing list archive)
State New
Headers show
Series target/loongarch: fix alignment error in tci. | expand

Commit Message

guoguangyao Nov. 18, 2024, 1:32 p.m. UTC
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 mbox series

Patch

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;
@@ -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 */