From: Michael Munday Date: Wed, 8 Jun 2016 16:11:44 +0000 (+0000) Subject: runtime/cgo: restore the g pointer correctly in crosscall_s390x X-Git-Tag: go1.7beta2~38 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=0324a3f828d3a2f48751df2bbd54ad20499e598a;p=gostls13.git runtime/cgo: restore the g pointer correctly in crosscall_s390x R13 needs to be set to g because C code may have clobbered R13. Fixes #16006. Change-Id: I66311fe28440e85e589a1695fa1c42416583b4c6 Reviewed-on: https://go-review.googlesource.com/23910 Reviewed-by: Ian Lance Taylor Run-TryBot: Ian Lance Taylor TryBot-Result: Gobot Gobot --- diff --git a/src/runtime/cgo/gcc_s390x.S b/src/runtime/cgo/gcc_s390x.S index 6b163d0d21..022f82d93e 100644 --- a/src/runtime/cgo/gcc_s390x.S +++ b/src/runtime/cgo/gcc_s390x.S @@ -21,9 +21,12 @@ crosscall_s390x: stdy %f4, 144(%r15) stdy %f6, 152(%r15) - /* assumes this call does not clobber r2 or r15 */ + /* set r0 to 0 */ xgr %r0, %r0 + /* restore g pointer */ + lgr %r13, %r3 + /* grow stack 8 bytes and call fn */ agfi %r15, -8 basr %r14, %r2