diff options
| author | Dmitriy Vyukov <dvyukov@google.com> | 2013-06-03 12:28:24 +0400 |
|---|---|---|
| committer | Dmitriy Vyukov <dvyukov@google.com> | 2013-06-03 12:28:24 +0400 |
| commit | f5becf4233bd12506cbfcb9cbc04b5968ac11ae0 (patch) | |
| tree | 8cd4b9fde8bb9ea0b9512b1482b35600c9e7a34c /src/pkg/runtime/proc.c | |
| parent | ae43ea432dae096add3bb02271fb143733ccd155 (diff) | |
| download | go-f5becf4233bd12506cbfcb9cbc04b5968ac11ae0.tar.xz | |
runtime: add stackguard0 to G
This is part of preemptive scheduler.
stackguard0 is checked in split stack checks and can be set to StackPreempt.
stackguard is not set to StackPreempt (holds the original value).
R=golang-dev, daniel.morsing, iant
CC=golang-dev
https://golang.org/cl/9875043
Diffstat (limited to 'src/pkg/runtime/proc.c')
| -rw-r--r-- | src/pkg/runtime/proc.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/pkg/runtime/proc.c b/src/pkg/runtime/proc.c index c7a8d24182..206a3cba19 100644 --- a/src/pkg/runtime/proc.c +++ b/src/pkg/runtime/proc.c @@ -468,6 +468,7 @@ runtime·mstart(void) // so other calls can reuse this stack space. runtime·gosave(&m->g0->sched); m->g0->sched.pc = (void*)-1; // make sure it is never used + m->g0->stackguard = m->g0->stackguard0; // cgo sets only stackguard0, copy it to stackguard m->seh = &seh; runtime·asminit(); runtime·minit(); @@ -615,6 +616,7 @@ runtime·needm(byte x) runtime·setmg(mp, mp->g0); g->stackbase = (uintptr)(&x + 1024); g->stackguard = (uintptr)(&x - 32*1024); + g->stackguard0 = g->stackguard; // On windows/386, we need to put an SEH frame (two words) // somewhere on the current stack. We are called @@ -979,6 +981,7 @@ execute(G *gp) runtime·throw("execute: bad g status"); } gp->status = Grunning; + gp->stackguard0 = gp->stackguard; m->p->tick++; m->curg = gp; gp->m = m; @@ -1465,6 +1468,7 @@ runtime·malg(int32 stacksize) } newg->stack0 = (uintptr)stk; newg->stackguard = (uintptr)stk + StackGuard; + newg->stackguard0 = newg->stackguard; newg->stackbase = (uintptr)stk + StackSystem + stacksize - sizeof(Stktop); runtime·memclr((byte*)newg->stackbase, sizeof(Stktop)); } |
