]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: manage stack by ourselves for badcallback on windows/amd64
authorShenghou Ma <minux.ma@gmail.com>
Wed, 14 Mar 2012 18:24:49 +0000 (02:24 +0800)
committerShenghou Ma <minux.ma@gmail.com>
Wed, 14 Mar 2012 18:24:49 +0000 (02:24 +0800)
This function uses 48-byte of precious non-split stack for every callback
function, and without this CL, it can easily overflow the non-split stack.
I encountered this when trying to enable misc/cgo/test on windows/amd64.

R=rsc
CC=golang-dev
https://golang.org/cl/5784075

src/pkg/runtime/sys_windows_amd64.s

index 041383ee89b8dbb3c4b9332d1d28031bd41e6e8d..11909cda278aa19b9d999ae07cec68aa762c7516 100644 (file)
@@ -60,7 +60,11 @@ loadregs:
 
        RET
 
-TEXT runtime·badcallback(SB),7,$48
+// This should be called on a system stack,
+// so we don't need to concern about split stack.
+TEXT runtime·badcallback(SB),7,$0
+       SUBQ    $48, SP
+
        // stderr
        MOVQ    $-12, CX // stderr
        MOVQ    CX, 0(SP)
@@ -80,6 +84,7 @@ TEXT runtime·badcallback(SB),7,$48
        MOVQ    runtime·WriteFile(SB), AX
        CALL    AX
        
+       ADDQ    $48, SP
        RET
 
 TEXT runtime·badsignal(SB),7,$48