]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: fix stack pointer corruption in runtime.cgocallback_gofunc()
authorShenghou Ma <minux.ma@gmail.com>
Mon, 29 Apr 2013 20:13:32 +0000 (04:13 +0800)
committerShenghou Ma <minux.ma@gmail.com>
Mon, 29 Apr 2013 20:13:32 +0000 (04:13 +0800)
runtime.setmg() calls another function (cgo_save_gm), so it must save
LR onto stack.
Re-enabled TestCthread test in misc/cgo/test.

Fixes #4863.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/9019043

misc/cgo/test/cthread.go
src/pkg/runtime/asm_arm.s

index bdfd1103d64e094c75055df6a0089e0d9e1277d7..68d4a03eacfee187755c9f31250f4415c81dcf10 100644 (file)
@@ -8,7 +8,6 @@ package cgotest
 import "C"
 
 import (
-       "runtime"
        "sync"
        "testing"
 )
@@ -31,10 +30,6 @@ func Add(x int) {
 }
 
 func testCthread(t *testing.T) {
-       if runtime.GOARCH == "arm" {
-               t.Skip("testCthread disabled on arm")
-       }
-
        sum.i = 0
        C.doAdd(10, 6)
 
index ee9acb749c8109250aec5573574da5581cfb8535..fed9b30215ee3da7d9a5d67b1ad33380abf1c610 100644 (file)
@@ -417,7 +417,7 @@ havem:
        RET
 
 // void setmg(M*, G*); set m and g. for use by needm.
-TEXT runtime·setmg(SB), 7, $-4
+TEXT runtime·setmg(SB), 7, $0
        MOVW    mm+0(FP), m
        MOVW    gg+4(FP), g