aboutsummaryrefslogtreecommitdiff
path: root/src/libthread/OpenBSD-386-asm.s
diff options
context:
space:
mode:
authorRuss Cox <rsc@swtch.com>2020-01-19 21:25:33 -0500
committerRuss Cox <rsc@swtch.com>2020-01-19 21:26:23 -0500
commit8dcb18f71b1917713d4743ab10968c527acdc62e (patch)
treeacc9640614ae66ae5568107710765fcc628afe1d /src/libthread/OpenBSD-386-asm.s
parentd15607b9ddd9872b48fe3ac8c68f9637044be310 (diff)
downloadplan9port-8dcb18f71b1917713d4743ab10968c527acdc62e.tar.gz
plan9port-8dcb18f71b1917713d4743ab10968c527acdc62e.tar.bz2
plan9port-8dcb18f71b1917713d4743ab10968c527acdc62e.zip
libthread: rm FreeBSD 4 code
Pretty sure FreeBSD 4 is gone now. :-)
Diffstat (limited to 'src/libthread/OpenBSD-386-asm.s')
-rw-r--r--src/libthread/OpenBSD-386-asm.s53
1 files changed, 52 insertions, 1 deletions
diff --git a/src/libthread/OpenBSD-386-asm.s b/src/libthread/OpenBSD-386-asm.s
index dad1b536..42169853 100644
--- a/src/libthread/OpenBSD-386-asm.s
+++ b/src/libthread/OpenBSD-386-asm.s
@@ -1 +1,52 @@
-#include "FreeBSD-386-asm.s"
+.globl _tas
+_tas:
+ movl $0xCAFEBABE, %eax
+ movl 4(%esp), %ecx
+ xchgl %eax, 0(%ecx)
+ ret
+
+.globl getmcontext
+getmcontext:
+ movl 4(%esp), %eax
+
+ movl %fs, 8(%eax)
+ movl %es, 12(%eax)
+ movl %ds, 16(%eax)
+ movl %ss, 76(%eax)
+ movl %edi, 20(%eax)
+ movl %esi, 24(%eax)
+ movl %ebp, 28(%eax)
+ movl %ebx, 36(%eax)
+ movl %edx, 40(%eax)
+ movl %ecx, 44(%eax)
+
+ movl $1, 48(%eax) /* %eax */
+ movl (%esp), %ecx /* %eip */
+ movl %ecx, 60(%eax)
+ leal 4(%esp), %ecx /* %esp */
+ movl %ecx, 72(%eax)
+
+ movl 44(%eax), %ecx /* restore %ecx */
+ movl $0, %eax
+ ret
+
+.globl setmcontext
+setmcontext:
+ movl 4(%esp), %eax
+
+ movl 8(%eax), %fs
+ movl 12(%eax), %es
+ movl 16(%eax), %ds
+ movl 76(%eax), %ss
+ movl 20(%eax), %edi
+ movl 24(%eax), %esi
+ movl 28(%eax), %ebp
+ movl 36(%eax), %ebx
+ movl 40(%eax), %edx
+ movl 44(%eax), %ecx
+
+ movl 72(%eax), %esp
+ pushl 60(%eax) /* new %eip */
+ movl 48(%eax), %eax
+ ret
+