summaryrefslogtreecommitdiff
path: root/src/cmd/tests/kernel/misc.s
diff options
context:
space:
mode:
authordzwdz2024-07-22 21:48:03 +0200
committerdzwdz2024-07-22 21:48:03 +0200
commita6fabfb78e70b8096a8bf336aa64a3358a2f5eca (patch)
treeefd544588d4de22dd59bf006217beddf5381ad62 /src/cmd/tests/kernel/misc.s
parent2be2236e99e5aed779b820b540d72dffb47da406 (diff)
tests: check if SSE registers are preserved on context switches
Diffstat (limited to 'src/cmd/tests/kernel/misc.s')
-rw-r--r--src/cmd/tests/kernel/misc.s27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/cmd/tests/kernel/misc.s b/src/cmd/tests/kernel/misc.s
new file mode 100644
index 0000000..ae1b567
--- /dev/null
+++ b/src/cmd/tests/kernel/misc.s
@@ -0,0 +1,27 @@
+.section .text
+.global _sse_test
+.type _sse_test, @function
+
+/* Written in assembly to ensure gcc won't mess with the XMM registers */
+_sse_test:
+ movdqu (%rdi), %xmm1
+ push %rdi /* preserve */
+
+ call fork
+ cmp $0, %rax
+ je child
+
+ /* in parent - wait for the child to die */
+ mov %rax, %rdi
+ mov $0, %rsi
+ mov $0, %rdx
+ call _sys_wait2
+
+ pop %rdi
+ movdqu %xmm1, (%rdi)
+ ret
+
+child:
+ pxor %xmm1, %xmm1
+ mov $0, %rdi
+ call _sys_exit