From: Keith Randall Date: Mon, 29 Sep 2014 06:52:08 +0000 (-0700) Subject: runtime: fix cgo_topofstack to save clobbered registers X-Git-Tag: go1.4beta1~261 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=e1364a6d0ecd5ba50845f416bb3c016bc54a3648;p=gostls13.git runtime: fix cgo_topofstack to save clobbered registers Fixes #8816 At least, I hope it does. TBR=rsc CC=golang-codereviews https://golang.org/cl/153730043 --- diff --git a/src/runtime/asm_arm.s b/src/runtime/asm_arm.s index 06bd0751db..36fb022f95 100644 --- a/src/runtime/asm_arm.s +++ b/src/runtime/asm_arm.s @@ -1303,9 +1303,17 @@ yieldloop: // Called from cgo wrappers, this function returns g->m->curg.stack.hi. // Must obey the gcc calling convention. -TEXT _cgo_topofstack(SB),NOSPLIT,$0 +TEXT _cgo_topofstack(SB),NOSPLIT,$8 + // R11 and g register are clobbered by load_g. They are + // callee-save in the gcc calling convention, so save them here. + MOVW R11, saveR11-4(SP) + MOVW g, saveG-8(SP) + BL runtime·load_g(SB) MOVW g_m(g), R0 MOVW m_curg(R0), R0 MOVW (g_stack+stack_hi)(R0), R0 + + MOVW saveG-8(SP), g + MOVW saveR11-4(SP), R11 RET