summary refs log tree commit diff stats
path: root/linux-user
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2023-11-01 11:08:11 +0800
committerSong Gao <gaosong@loongson.cn>2023-11-03 14:13:18 +0800
commit91ffd93be614da080a6dd8826d999e3e4761f78b (patch)
treec4fbc2dc2e9a6e61cea08c88120b2b9ca4b5c9af /linux-user
parent1d832c19db1e895b7d8015c3b33fc6311e20a69c (diff)
downloadfocaccia-qemu-91ffd93be614da080a6dd8826d999e3e4761f78b.tar.gz
focaccia-qemu-91ffd93be614da080a6dd8826d999e3e4761f78b.zip
linux-user/loongarch64: Use traps to track LSX/LASX usage
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20231101030816.2353416-2-gaosong@loongson.cn>
Signed-off-by: Song Gao <gaosong@loongson.cn>
Diffstat (limited to 'linux-user')
-rw-r--r--linux-user/loongarch64/cpu_loop.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/linux-user/loongarch64/cpu_loop.c b/linux-user/loongarch64/cpu_loop.c
index 894fdd111a..73d7b6796a 100644
--- a/linux-user/loongarch64/cpu_loop.c
+++ b/linux-user/loongarch64/cpu_loop.c
@@ -72,6 +72,19 @@ void cpu_loop(CPULoongArchState *env)
         case EXCCODE_BCE:
             force_sig_fault(TARGET_SIGSYS, TARGET_SI_KERNEL, env->pc);
             break;
+
+        /*
+         * Begin with LSX and LASX disabled, then enable on the first trap.
+         * In this way we can tell if the unit is in use.  This is used to
+         * choose the layout of any signal frame.
+         */
+        case EXCCODE_SXD:
+            env->CSR_EUEN |= R_CSR_EUEN_SXE_MASK;
+            break;
+        case EXCCODE_ASXD:
+            env->CSR_EUEN |= R_CSR_EUEN_ASXE_MASK;
+            break;
+
         case EXCP_ATOMIC:
             cpu_exec_step_atomic(cs);
             break;