qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] target/loongarch: fix alignment error in tci.


From: guoguangyao
Subject: [PATCH] target/loongarch: fix alignment error in tci.
Date: Mon, 18 Nov 2024 21:32:43 +0800

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]