]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: Plan 9: fix errstr
authorAkshat Kumar <seed@mail.nanosouffle.net>
Sat, 9 Mar 2013 04:39:15 +0000 (05:39 +0100)
committerRon Minnich <rminnich@gmail.com>
Sat, 9 Mar 2013 04:39:15 +0000 (05:39 +0100)
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

src/pkg/runtime/sys_plan9_386.s
src/pkg/runtime/sys_plan9_amd64.s

index 09211e8807fc6646217bca6e51771a37e0b75a33..1f860a96190bd6503891fdc9fcee3b9da4ba112e 100644 (file)
@@ -187,6 +187,13 @@ TEXT runtime·errstr(SB),7,$0
        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
index 68563f3e3ca2ede31048d9eaed7adb5d5e6c2578..c0c896ebc9a182a6de64bb8d3282deb68da7b418 100644 (file)
@@ -224,6 +224,13 @@ TEXT runtime·errstr(SB),7,$0
        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