aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/panic.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/panic.go')
-rw-r--r--src/runtime/panic.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/runtime/panic.go b/src/runtime/panic.go
index 2dd3c3c2db..1ed2503320 100644
--- a/src/runtime/panic.go
+++ b/src/runtime/panic.go
@@ -391,10 +391,15 @@ func deferrangefunc() any {
throw("defer on system stack")
}
+ fn := findfunc(sys.GetCallerPC())
+ if fn.deferreturn == 0 {
+ throw("no deferreturn")
+ }
+
d := newdefer()
d.link = gp._defer
gp._defer = d
- d.pc = sys.GetCallerPC()
+ d.pc = fn.entry() + uintptr(fn.deferreturn)
// We must not be preempted between calling GetCallerSP and
// storing it to d.sp because GetCallerSP's result is a
// uintptr stack pointer.
@@ -1258,6 +1263,8 @@ func recovery(gp *g) {
// only gets us to the caller's fp.
gp.sched.bp = sp - goarch.PtrSize
}
+ // The value in ret is delivered IN A REGISTER, even if there is a
+ // stack ABI.
gp.sched.ret = 1
gogo(&gp.sched)
}