shithub: mc

Download patch

ref: 0b99465823930170bb45c9264c10ed5936be5bb4
parent: b1cd018c05d289e45529d5e15b928a1cae177223
author: glenda@drat <glenda@drat>
date: Thu May 26 02:53:29 EDT 2016

Add plan9 implementations of recent additions.

--- a/lib/std/bld.sub
+++ b/lib/std/bld.sub
@@ -47,6 +47,7 @@
 	result.myr
 	search.myr
 	sjlj.myr
+	sjlj-impl+plan9-x64.s
 	sjlj-impl+posixy-x64.s
 	slcp.myr
 	sldup.myr
--- /dev/null
+++ b/lib/std/sjlj-impl+plan9-x64.s
@@ -1,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
--- a/lib/std/sjlj-impl+posixy-x64.s
+++ b/lib/std/sjlj-impl+posixy-x64.s
@@ -11,13 +11,13 @@
 	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
--- a/test/runtest.rc
+++ b/test/runtest.rc
@@ -12,11 +12,13 @@
 
 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 @@
 	type=$1; shift
 	res=$1; shift
 
+	echo "test $test <<{!"
 	build $test
 	switch($type) {
 	case E
@@ -76,6 +79,7 @@
 }
 
 fn F {
+	echo "test $test <<{!"
 	@{ build $1 } > /dev/null
 	if (~ $status ''/)
 		fail $1
@@ -83,6 +87,7 @@
 		pass $1
 }
 
+echo "MTEST `{grep '^[BF]' tests | wc -l}"
 
 . tests