aboutsummaryrefslogtreecommitdiff
path: root/src/libthread/Darwin-x86_64-asm.s
diff options
context:
space:
mode:
authorRuss Cox <rsc@swtch.com>2011-10-13 23:57:54 -0400
committerRuss Cox <rsc@swtch.com>2011-10-13 23:57:54 -0400
commit04e0a9bb81356b6713e634b4d950c524f0abf15c (patch)
treeda1ccfc331da22c932e88016892a1e3c5b99aea5 /src/libthread/Darwin-x86_64-asm.s
parentf1825251e73ffd1c750ab14950bd1e5374991ae5 (diff)
downloadplan9port-04e0a9bb81356b6713e634b4d950c524f0abf15c.tar.gz
plan9port-04e0a9bb81356b6713e634b4d950c524f0abf15c.tar.bz2
plan9port-04e0a9bb81356b6713e634b4d950c524f0abf15c.zip
libthread: Lion context routines
Diffstat (limited to 'src/libthread/Darwin-x86_64-asm.s')
-rw-r--r--src/libthread/Darwin-x86_64-asm.s44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/libthread/Darwin-x86_64-asm.s b/src/libthread/Darwin-x86_64-asm.s
new file mode 100644
index 00000000..d50d3b6d
--- /dev/null
+++ b/src/libthread/Darwin-x86_64-asm.s
@@ -0,0 +1,44 @@
+.text
+.align 8
+
+.globl _libthread_getmcontext
+_libthread_getmcontext:
+ movq $1, 0*8(%rdi) // rax
+ movq %rbx, 1*8(%rdi)
+ movq %rcx, 2*8(%rdi)
+ movq %rdx, 3*8(%rdi)
+ movq %rsi, 4*8(%rdi)
+ movq %rdi, 5*8(%rdi)
+ movq %rbp, 6*8(%rdi)
+ movq %rsp, 7*8(%rdi)
+ movq %r8, 8*8(%rdi)
+ movq %r9, 9*8(%rdi)
+ movq %r10, 10*8(%rdi)
+ movq %r11, 11*8(%rdi)
+ movq %r12, 12*8(%rdi)
+ movq %r13, 13*8(%rdi)
+ movq %r14, 14*8(%rdi)
+ movq %r15, 15*8(%rdi)
+ movq $0, %rax
+ ret
+
+.globl _libthread_setmcontext
+_libthread_setmcontext:
+ movq 0*8(%rdi), %rax
+ movq 1*8(%rdi), %rbx
+ movq 2*8(%rdi), %rcx
+ movq 3*8(%rdi), %rdx
+ movq 4*8(%rdi), %rsi
+ // %rdi later
+ movq 6*8(%rdi), %rbp
+ movq 7*8(%rdi), %rsp
+ movq 8*8(%rdi), %r8
+ movq 9*8(%rdi), %r9
+ movq 10*8(%rdi), %r10
+ movq 11*8(%rdi), %r11
+ movq 12*8(%rdi), %r12
+ movq 13*8(%rdi), %r13
+ movq 14*8(%rdi), %r14
+ movq 15*8(%rdi), %r15
+ movq 5*8(%rdi), %rdi
+ ret