diff options
Diffstat (limited to 'src/runtime/proc1.go')
| -rw-r--r-- | src/runtime/proc1.go | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/runtime/proc1.go b/src/runtime/proc1.go index 36390460ca..5e5d0efa0b 100644 --- a/src/runtime/proc1.go +++ b/src/runtime/proc1.go @@ -2042,15 +2042,19 @@ func newproc1(fn *funcval, argp *uint8, narg int32, nret int32, callerpc uintptr throw("newproc1: new g is not Gdead") } - sp := newg.stack.hi - sp -= 4 * regSize // extra space in case of reads slightly beyond frame - sp -= uintptr(siz) - memmove(unsafe.Pointer(sp), unsafe.Pointer(argp), uintptr(narg)) + totalSize := 4*regSize + uintptr(siz) // extra space in case of reads slightly beyond frame + if hasLinkRegister { + totalSize += ptrSize + } + totalSize += -totalSize & (spAlign - 1) // align to spAlign + sp := newg.stack.hi - totalSize + spArg := sp if hasLinkRegister { // caller's LR - sp -= ptrSize *(*unsafe.Pointer)(unsafe.Pointer(sp)) = nil + spArg += ptrSize } + memmove(unsafe.Pointer(spArg), unsafe.Pointer(argp), uintptr(narg)) memclr(unsafe.Pointer(&newg.sched), unsafe.Sizeof(newg.sched)) newg.sched.sp = sp |
