Commit e1b47159 authored by Ian Lance Taylor's avatar Ian Lance Taylor

Save the scheduling state even predawn.

This permits cgo callbacks to work when run in init code.
Otherwise cgocallback switches to the wrong stack address.

R=rsc
CC=golang-dev
https://golang.org/cl/1123043
parent 6d7583d5
......@@ -551,15 +551,15 @@ void
·entersyscall(void)
{
lock(&sched);
// Leave SP around for gc and traceback.
// Do before notewakeup so that gc
// never sees Gsyscall with wrong stack.
gosave(&g->sched);
if(sched.predawn) {
unlock(&sched);
return;
}
g->status = Gsyscall;
// Leave SP around for gc and traceback.
// Do before notewakeup so that gc
// never sees Gsyscall with wrong stack.
gosave(&g->sched);
sched.mcpu--;
sched.msyscall++;
if(sched.gwait != 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment