aboutsummaryrefslogtreecommitdiff
path: root/src/pkg
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg')
-rw-r--r--src/pkg/runtime/panic.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/pkg/runtime/panic.c b/src/pkg/runtime/panic.c
index 120f7706e7..5692c537a0 100644
--- a/src/pkg/runtime/panic.c
+++ b/src/pkg/runtime/panic.c
@@ -175,10 +175,19 @@ runtime·deferreturn(uintptr arg0, ...)
argp = (byte*)&arg0;
if(d->argp != argp)
return;
+
+ // Moving arguments around.
+ // Do not allow preemption here, because the garbage collector
+ // won't know the form of the arguments until the jmpdefer can
+ // flip the PC over to fn.
+ m->locks++;
runtime·memmove(argp, d->args, d->siz);
fn = d->fn;
popdefer();
freedefer(d);
+ m->locks--;
+ if(m->locks == 0 && g->preempt)
+ g->stackguard0 = StackPreempt;
runtime·jmpdefer(fn, argp);
}