summaryrefslogtreecommitdiff
path: root/lib
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
parentb1cd018c05d289e45529d5e15b928a1cae177223 (diff)
downloadmc-0b99465823930170bb45c9264c10ed5936be5bb4.tar.gz
Add plan9 implementations of recent additions.
Diffstat (limited to 'lib')
-rw-r--r--lib/std/bld.sub1
-rw-r--r--lib/std/sjlj-impl+plan9-x64.s38
-rw-r--r--lib/std/sjlj-impl+posixy-x64.s10
3 files changed, 44 insertions, 5 deletions
diff --git a/lib/std/bld.sub b/lib/std/bld.sub
index 471455e..f5d395e 100644
--- a/lib/std/bld.sub
+++ b/lib/std/bld.sub
@@ -47,6 +47,7 @@ lib std {inc=.} =
result.myr
search.myr
sjlj.myr
+ sjlj-impl+plan9-x64.s
sjlj-impl+posixy-x64.s
slcp.myr
sldup.myr
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
diff --git a/lib/std/sjlj-impl+posixy-x64.s b/lib/std/sjlj-impl+posixy-x64.s
index 1f1fadb..a8d9edc 100644
--- a/lib/std/sjlj-impl+posixy-x64.s
+++ b/lib/std/sjlj-impl+posixy-x64.s
@@ -11,13 +11,13 @@ _std$setjmp:
movq %r15, 40(%rdi)
/* save %rsp */
- leaq 8(%rsp),%rdx
- movq %rdx,48(%rdi)
+ leaq 8(%rsp), %rdx
+ movq %rdx, 48(%rdi)
/* save %rip */
- movq (%rsp),%rdx
- movq %rdx,56(%rdi)
- xorq %rax,%rax
+ movq (%rsp), %rdx
+ movq %rdx, 56(%rdi)
+ xorq %rax, %rax
ret
.globl std$longjmp