| 1 |
// Copyright 2016 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 |
package runtime |
| 6 |
|
| 7 |
import ( |
| 8 |
"unsafe" |
| 9 |
|
| 10 |
"internal/abi" |
| 11 |
"internal/runtime/sys" |
| 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 |
if buf.lr != 0 { |
| 18 |
throw("invalid use of gostartcall") |
| 19 |
} |
| 20 |
// Use double the PC quantum on riscv64, so that we retain |
| 21 |
// four byte alignment and use non-compressed instructions. |
| 22 |
buf.lr = abi.FuncPCABI0(goexit) + sys.PCQuantum*2 |
| 23 |
buf.pc = uintptr(fn) |
| 24 |
buf.ctxt = ctxt |
| 25 |
} |