]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: fix openbsd/386
authorMatthew Dempsky <mdempsky@google.com>
Thu, 28 Aug 2014 21:23:25 +0000 (14:23 -0700)
committerIan Lance Taylor <iant@golang.org>
Thu, 28 Aug 2014 21:23:25 +0000 (14:23 -0700)
In revision 05c3fee13eb3, openbsd/386's tfork implementation was
accidentally changed in one instruction from using the "params"
parameter to using the "psize" parameter.

While here, OpenBSD's __tfork system call returns a pid_t which is an
int32 on all OpenBSD architectures, so change runtime.tfork's return
type from int64 to int32 and update the assembly implementations
accordingly.

LGTM=iant
R=rsc, iant
CC=golang-codereviews, jsing
https://golang.org/cl/133190043

src/pkg/runtime/os_openbsd.c
src/pkg/runtime/os_openbsd.go
src/pkg/runtime/sys_openbsd_386.s
src/pkg/runtime/sys_openbsd_amd64.s

index 220091535d7c582711b69724c1b7a382a430a813..60db7efdd997eccf6e19b30a55d830b37cd38800 100644 (file)
@@ -26,7 +26,7 @@ extern SigTab runtime·sigtab[];
 static Sigset sigset_none;
 static Sigset sigset_all = ~(Sigset)0;
 
-extern int64 runtime·tfork(void *param, uintptr psize, M *mp, G *gp, void (*fn)(void));
+extern int32 runtime·tfork(void *param, uintptr psize, M *mp, G *gp, void (*fn)(void));
 extern int32 runtime·thrsleep(void *ident, int32 clock_id, void *tsp, void *lock, const int32 *abort);
 extern int32 runtime·thrwakeup(void *ident, int32 n);
 
index 6bb6baa62c586460565e1aaada072185408a81fd..4982f903e3fefbca3b97bb660395df5606489afc 100644 (file)
@@ -15,6 +15,6 @@ func raise(sig int32)
 func kqueue() int32
 func kevent(fd int32, ev1 unsafe.Pointer, nev1 int32, ev2 unsafe.Pointer, nev2 int32, ts unsafe.Pointer) int32
 func closeonexec(fd int32)
-func tfork(param unsafe.Pointer, psize uintptr, mm, gg, fn unsafe.Pointer) int64
+func tfork(param unsafe.Pointer, psize uintptr, mm, gg, fn unsafe.Pointer) int32
 func thrsleep(ident unsafe.Pointer, clock_id int32, tsp, lock, abort unsafe.Pointer) int32
 func thrwakeup(ident unsafe.Pointer, n int32) int32
index 596d45a0237f3d54b58f00140434b968e30e6a53..d836a1f9ea851329adf99b05fa684a0cdfb0b821 100644 (file)
@@ -226,7 +226,7 @@ sigtramp_ret:
 TEXT runtime·tfork(SB),NOSPLIT,$12
 
        // Copy mp, gp and fn from the parent stack onto the child stack.
-       MOVL    psize+4(FP), AX
+       MOVL    param+0(FP), AX
        MOVL    8(AX), CX               // tf_stack
        SUBL    $16, CX
        MOVL    CX, 8(AX)
@@ -247,17 +247,15 @@ TEXT runtime·tfork(SB),NOSPLIT,$12
        INT     $0x80
 
        // Return if tfork syscall failed.
-       JCC     5(PC)
+       JCC     4(PC)
        NEGL    AX
-       MOVL    AX, ret_lo+20(FP)
-       MOVL    $-1, ret_hi+24(FP)
+       MOVL    AX, ret+20(FP)
        RET
 
        // In parent, return.
        CMPL    AX, $0
-       JEQ     4(PC)
-       MOVL    AX, ret_lo+20(FP)
-       MOVL    $0, ret_hi+24(FP)
+       JEQ     3(PC)
+       MOVL    AX, ret+20(FP)
        RET
 
        // Paranoia: check that SP is as we expect.
index eb5010164c6c45b743b6e07efaaef16b85a68149..e9371c3b6390c5aeb5586b98a9071ab719e8563a 100644 (file)
@@ -11,7 +11,7 @@
 
 #define CLOCK_MONOTONIC        $3
 
-// int64 tfork(void *param, uintptr psize, M *mp, G *gp, void (*fn)(void));
+// int32 tfork(void *param, uintptr psize, M *mp, G *gp, void (*fn)(void));
 TEXT runtime·tfork(SB),NOSPLIT,$32
 
        // Copy mp, gp and fn off parent stack for use by child.
@@ -27,13 +27,13 @@ TEXT runtime·tfork(SB),NOSPLIT,$32
        // Return if tfork syscall failed.
        JCC     4(PC)
        NEGQ    AX
-       MOVQ    AX, ret+40(FP)
+       MOVL    AX, ret+40(FP)
        RET
 
        // In parent, return.
        CMPL    AX, $0
        JEQ     3(PC)
-       MOVQ    AX, ret+40(FP)
+       MOVL    AX, ret+40(FP)
        RET
 
        // Set FS to point at m->tls.