Home | History | Annotate | Download | only in runtime
      1 // Copyright 2013 The Go Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style
      3 // license that can be found in the LICENSE file.
      4 
      5 // +build amd64 amd64p32 386
      6 
      7 package runtime
      8 
      9 import (
     10 	"runtime/internal/sys"
     11 	"unsafe"
     12 )
     13 
     14 // adjust Gobuf as if it executed a call to fn with context ctxt
     15 // and then did an immediate gosave.
     16 func gostartcall(buf *gobuf, fn, ctxt unsafe.Pointer) {
     17 	sp := buf.sp
     18 	if sys.RegSize > sys.PtrSize {
     19 		sp -= sys.PtrSize
     20 		*(*uintptr)(unsafe.Pointer(sp)) = 0
     21 	}
     22 	sp -= sys.PtrSize
     23 	*(*uintptr)(unsafe.Pointer(sp)) = buf.pc
     24 	buf.sp = sp
     25 	buf.pc = uintptr(fn)
     26 	buf.ctxt = ctxt
     27 }
     28