summaryrefslogtreecommitdiff
path: root/lib/std/sjlj-impl+plan9-x64.s
diff options
context:
space:
mode:
authorglenda@drat <glenda@drat>2016-05-26 06:53:29 -0700
committerglenda@drat <glenda@drat>2016-05-26 06:53:29 -0700
commit0b99465823930170bb45c9264c10ed5936be5bb4 (patch)
tree24ae34212e030ce074649007528b665c878b60e4 /lib/std/sjlj-impl+plan9-x64.s
parentb1cd018c05d289e45529d5e15b928a1cae177223 (diff)
downloadmc-0b99465823930170bb45c9264c10ed5936be5bb4.tar.gz
Add plan9 implementations of recent additions.
Diffstat (limited to 'lib/std/sjlj-impl+plan9-x64.s')
-rw-r--r--lib/std/sjlj-impl+plan9-x64.s38
1 files changed, 38 insertions, 0 deletions
diff --git a/lib/std/sjlj-impl+plan9-x64.s b/lib/std/sjlj-impl+plan9-x64.s
new file mode 100644
index 0000000..6334b92
--- /dev/null
+++ b/lib/std/sjlj-impl+plan9-x64.s
@@ -0,0 +1,38 @@
+TEXT std$setjmp+0(SB),$0
+ /* save registers */
+ MOVQ BX, (DI)
+ MOVQ BP, 8(DI)
+ MOVQ R12, 16(DI)
+ MOVQ R13, 24(DI)
+ MOVQ R14, 32(DI)
+ MOVQ R15, 40(DI)
+
+ /* save sp */
+ LEAQ 8(SP),DX
+ MOVQ DX, 48(DI)
+
+ /* save ip */
+ MOVQ (SP), DX
+ MOVQ DX, 56(DI)
+ XORQ AX, AX
+ RET
+
+TEXT std$longjmp+0(SB),$0
+ /* return true */
+ MOVQ $1, AX
+
+ /* restore registers */
+ MOVQ (DI), BX
+ MOVQ 8(DI), BP
+ MOVQ 16(DI), R12
+ MOVQ 24(DI), R13
+ MOVQ 32(DI), R14
+ MOVQ 40(DI), R15
+ MOVQ 48(DI), DX
+
+ /* load stack */
+ MOVQ DX, SP
+
+ /* jmp to return addr */
+ MOVQ 56(DI), DX
+ JMP *DX