runtime: Plan 9: fix errstr
The call to the C function runtime.findnull() requires
that we provide the argument at 0(SP).
R=rsc, rminnich, ality
CC=golang-dev
https://golang.org/cl/7559047
diff --git a/src/pkg/runtime/sys_plan9_386.s b/src/pkg/runtime/sys_plan9_386.s
index 09211e8..1f860a9 100644
--- a/src/pkg/runtime/sys_plan9_386.s
+++ b/src/pkg/runtime/sys_plan9_386.s
@@ -187,6 +187,13 @@
MOVL $ERRMAX, 8(SP)
MOVL $41, AX
INT $64
+
+ // syscall requires caller-save
+ MOVL 4(SP), CX
+
+ // push the argument
+ PUSHL CX
CALL runtime·findnull(SB)
+ POPL CX
MOVL AX, 8(SP)
RET
diff --git a/src/pkg/runtime/sys_plan9_amd64.s b/src/pkg/runtime/sys_plan9_amd64.s
index 68563f3..c0c896e 100644
--- a/src/pkg/runtime/sys_plan9_amd64.s
+++ b/src/pkg/runtime/sys_plan9_amd64.s
@@ -224,6 +224,13 @@
MOVQ $0x8000, AX
MOVQ $41, BP
SYSCALL
+
+ // syscall requires caller-save
+ MOVQ 8(SP), CX
+
+ // push the argument
+ PUSHQ CX
CALL runtime·findnull(SB)
+ POPQ CX
MOVQ AX, 16(SP)
RET