summaryrefslogtreecommitdiff
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
parentb1cd018c05d289e45529d5e15b928a1cae177223 (diff)
downloadmc-0b99465823930170bb45c9264c10ed5936be5bb4.tar.gz
Add plan9 implementations of recent additions.
-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
-rwxr-xr-xtest/runtest.rc7
4 files changed, 50 insertions, 6 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
diff --git a/test/runtest.rc b/test/runtest.rc
index 6723658..6b6a8c5 100755
--- a/test/runtest.rc
+++ b/test/runtest.rc
@@ -12,11 +12,13 @@ fn build {
fn pass {
passed=$passed ^ ' ' ^ $1
+ echo "!}>> ok"
}
fn fail {
echo FAIL: $1
- failed=$failed ^ ' ' ^ $1
+ failed=$failed ^ ' ' ^ $1}
+ echo "!}>> fail $1"
}
fn expectstatus {
@@ -62,6 +64,7 @@ fn B {
type=$1; shift
res=$1; shift
+ echo "test $test <<{!"
build $test
switch($type) {
case E
@@ -76,6 +79,7 @@ fn B {
}
fn F {
+ echo "test $test <<{!"
@{ build $1 } > /dev/null
if (~ $status ''/)
fail $1
@@ -83,6 +87,7 @@ fn F {
pass $1
}
+echo "MTEST `{grep '^[BF]' tests | wc -l}"
. tests