diff options
| author | Cherry Zhang <cherryyz@google.com> | 2021-04-19 13:58:07 -0400 |
|---|---|---|
| committer | Cherry Zhang <cherryyz@google.com> | 2021-04-19 18:37:15 +0000 |
| commit | f8892147bdfd16fe7ef04eccf59c4abf774550f1 (patch) | |
| tree | cfdc56c6e3aa55edc8f528629b27df5fb53fcfc3 /src | |
| parent | 5780ab4f605fdf0ca7f12ebc08e80d3ac170e98a (diff) | |
| download | go-f8892147bdfd16fe7ef04eccf59c4abf774550f1.tar.xz | |
runtime: open up space for callee's arg spill slot in mcall (regabi version)
mcall calls fn with an argument. Currently, in the regabi version
of mcall it does not reserve space for that argument's spill slot.
If the callee spills its argument, it may clobber things on the
g0 stack at 0(SP) (e.g. the old SP saved in cgocallback).
Reserve the space.
Change-Id: I85a314273cd996c7fac8fd0b03cd9033faae9c5a
Reviewed-on: https://go-review.googlesource.com/c/go/+/311489
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/runtime/asm_amd64.s | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/runtime/asm_amd64.s b/src/runtime/asm_amd64.s index ca6b1501d1..1e6d8189c9 100644 --- a/src/runtime/asm_amd64.s +++ b/src/runtime/asm_amd64.s @@ -302,8 +302,10 @@ goodm: get_tls(CX) // Set G in TLS MOVQ R14, g(CX) MOVQ (g_sched+gobuf_sp)(R14), SP // sp = g0.sched.sp + PUSHQ AX // open up space for fn's arg spill slot MOVQ 0(DX), R12 CALL R12 // fn(g) + POPQ AX JMP runtime·badmcall2(SB) RET #else |
