diff options
author | Keith Randall <khr@golang.org> | 2014-09-11 20:36:23 -0700 |
---|---|---|
committer | Keith Randall <khr@golang.org> | 2014-09-11 20:36:23 -0700 |
commit | a6669fa5e7d26c7e5f9d61a389450d2c1ef79f1c (patch) | |
tree | bcdb9c5f99f9f09e56e9b318f0747e568fc0223e /src/runtime/asm_386.s | |
parent | 6a22ebd3880e3f551720c518a5850535c601453b (diff) | |
download | go-a6669fa5e7d26c7e5f9d61a389450d2c1ef79f1c.tar.gz |
runtime: fix cgo to handle the case where the G stack is copied.
Tests will come in a separate CL after the funcdata stuff is resolved.
Update issue 8696
LGTM=iant, rsc
R=rsc, iant
CC=golang-codereviews
https://codereview.appspot.com/138330045
Diffstat (limited to 'src/runtime/asm_386.s')
-rw-r--r-- | src/runtime/asm_386.s | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/runtime/asm_386.s b/src/runtime/asm_386.s index 062a668e3..37ad09241 100644 --- a/src/runtime/asm_386.s +++ b/src/runtime/asm_386.s @@ -684,15 +684,19 @@ TEXT asmcgocall<>(SB),NOSPLIT,$0-12 SUBL $32, SP ANDL $~15, SP // alignment, perhaps unnecessary MOVL DI, 8(SP) // save g - MOVL DX, 4(SP) // save SP + MOVL (g_stack+stack_hi)(DI), DI + SUBL DX, DI + MOVL DI, 4(SP) // save depth in stack (can't just save SP, as stack might be copied during a callback) MOVL BX, 0(SP) // first argument in x86-32 ABI CALL AX // Restore registers, g, stack pointer. get_tls(CX) MOVL 8(SP), DI + MOVL (g_stack+stack_hi)(DI), SI + SUBL 4(SP), SI MOVL DI, g(CX) - MOVL 4(SP), SP + MOVL SI, SP RET // cgocallback(void (*fn)(void*), void *frame, uintptr framesize) |