| 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 |
//go:build amd64 || 386 |
| 6 |
|
| 7 |
package runtime |
| 8 |
|
| 9 |
import ( |
| 10 |
"internal/goarch" |
| 11 |
"unsafe" |
| 12 |
) |
| 13 |
|
| 14 |
// adjust Gobuf as if it executed a call to fn with context ctxt |
| 15 |
// and then stopped before the first instruction in fn. |
| 16 |
func gostartcall(buf *gobuf, fn, ctxt unsafe.Pointer) { |
| 17 |
sp := buf.sp |
| 18 |
sp -= goarch.PtrSize |
| 19 |
*(*uintptr)(unsafe.Pointer(sp)) = buf.pc |
| 20 |
buf.sp = sp |
| 21 |
buf.pc = uintptr(fn) |
| 22 |
buf.ctxt = ctxt |
| 23 |
} |