1 // Copyright 2015 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.
5 // +build mips64 mips64le
11 // adjust Gobuf as if it executed a call to fn with context ctxt
12 // and then did an immediate Gosave.
13 func gostartcall(buf
*gobuf
, fn
, ctxt unsafe
.Pointer
) {
15 throw("invalid use of gostartcall")
22 // Called to rewind context saved during morestack back to beginning of function.
23 // To help us, the linker emits a jmp back to the beginning right after the
24 // call to morestack. We just have to decode and apply that jump.
25 func rewindmorestack(buf
*gobuf
) {
27 if buf
.pc
&3 == 0 && buf
.pc
!= 0 {
28 inst
= *(*uint32)(unsafe
.Pointer(buf
.pc
))
29 if inst
>>26 == 2 { // JMP addr
30 //print("runtime: rewind pc=", hex(buf.pc), " to pc=", hex(buf.pc &^ uintptr(1<<28-1) | uintptr((inst&^0xfc000000)<<2)), "\n");
32 buf
.pc |
= uintptr((inst
&^ 0xfc000000) << 2)
35 if inst
>>16 == 0x1000 { // BEQ R0, R0, offset
36 //print("runtime: rewind pc=", hex(buf.pc), " to pc=", hex(buf.pc + uintptr(int32(int16(inst&0xffff))<<2 + 4)), "\n");
37 buf
.pc
+= uintptr(int32(int16(inst
&0xffff))<<2 + 4)
41 print("runtime: pc=", hex(buf
.pc
), " ", hex(inst
), "\n")
42 throw("runtime: misuse of rewindmorestack")