diff options
| author | Dmitriy Vyukov <dvyukov@google.com> | 2014-08-22 22:13:01 +0400 |
|---|---|---|
| committer | Dmitriy Vyukov <dvyukov@google.com> | 2014-08-22 22:13:01 +0400 |
| commit | afb2260491e6427fa9b2e7fc629dac736113cfa6 (patch) | |
| tree | 63ba3b5291e940fa212e9996cb90e0ce70dd1b92 /src/pkg/runtime/proc.c | |
| parent | f4485784f05908051e7ec1732a27f53241f48fc4 (diff) | |
| download | go-afb2260491e6427fa9b2e7fc629dac736113cfa6.tar.xz | |
runtime: convert note to Go
Note is required for timers and heap scavenger.
LGTM=rsc
R=golang-codereviews, rsc
CC=golang-codereviews, khr, rlh
https://golang.org/cl/128620043
Diffstat (limited to 'src/pkg/runtime/proc.c')
| -rw-r--r-- | src/pkg/runtime/proc.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/pkg/runtime/proc.c b/src/pkg/runtime/proc.c index 5ff38fb692..df85042340 100644 --- a/src/pkg/runtime/proc.c +++ b/src/pkg/runtime/proc.c @@ -1630,6 +1630,31 @@ void g->m->locks--; } +// The same as runtime·entersyscallblock(), but called on g0 stack. +void +runtime·entersyscallblock_m(void) +{ + G *gp; + + gp = g->m->curg; + // sched.{g,pc,sp,lr} are already set by mcall. + gp->stackguard0 = StackPreempt; // we are on g0, the goroutine must not touch its stack until exitsyscall + gp->sched.ret = 0; + gp->sched.ctxt = 0; + gp->syscallsp = gp->sched.sp; + gp->syscallpc = gp->sched.pc; + gp->syscallstack = gp->stackbase; + gp->syscallguard = gp->stackguard; + gp->status = Gsyscall; + if(gp->syscallsp < gp->syscallguard-StackGuard || gp->syscallstack < gp->syscallsp) { + // runtime·printf("entersyscall inconsistent %p [%p,%p]\n", + // gp->syscallsp, gp->syscallguard-StackGuard, gp->syscallstack); + runtime·throw("entersyscall_m"); + } + + handoffp(releasep()); +} + // The goroutine g exited its system call. // Arrange for it to run on a cpu again. // This is called only from the go syscall library, not |
