summaryrefslogtreecommitdiff
path: root/src/pkg/runtime/proc.c
diff options
context:
space:
mode:
authorMichael Stapelberg <stapelberg@debian.org>2014-09-26 23:20:11 +0200
committerMichael Stapelberg <stapelberg@debian.org>2014-09-26 23:20:11 +0200
commit40fff9d31718d66485b576c0feeb439778d624e3 (patch)
treebfa3bec31e846655c0a527af8c20810b1e11bfd3 /src/pkg/runtime/proc.c
parent8907f7bcc6fd6be6a540717778b4f15bb24f6ecf (diff)
parentf4fa1ef6e6ccd9264db61c6400528158e5913bda (diff)
downloadgolang-40fff9d31718d66485b576c0feeb439778d624e3.tar.gz
Merge tag 'upstream/1.3.2' into debian-sid
Upstream version 1.3.2
Diffstat (limited to 'src/pkg/runtime/proc.c')
-rw-r--r--src/pkg/runtime/proc.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/pkg/runtime/proc.c b/src/pkg/runtime/proc.c
index 914a02e0b..de4f70153 100644
--- a/src/pkg/runtime/proc.c
+++ b/src/pkg/runtime/proc.c
@@ -1499,14 +1499,14 @@ save(void *pc, uintptr sp)
// entersyscall is going to return immediately after.
#pragma textflag NOSPLIT
void
-·entersyscall(int32 dummy)
+runtime·reentersyscall(void *pc, uintptr sp)
{
// Disable preemption because during this function g is in Gsyscall status,
// but can have inconsistent g->sched, do not let GC observe it.
m->locks++;
// Leave SP around for GC and traceback.
- save(runtime·getcallerpc(&dummy), runtime·getcallersp(&dummy));
+ save(pc, sp);
g->syscallsp = g->sched.sp;
g->syscallpc = g->sched.pc;
g->syscallstack = g->stackbase;
@@ -1525,7 +1525,7 @@ void
runtime·notewakeup(&runtime·sched.sysmonnote);
}
runtime·unlock(&runtime·sched);
- save(runtime·getcallerpc(&dummy), runtime·getcallersp(&dummy));
+ save(pc, sp);
}
m->mcache = nil;
@@ -1538,7 +1538,7 @@ void
runtime·notewakeup(&runtime·sched.stopnote);
}
runtime·unlock(&runtime·sched);
- save(runtime·getcallerpc(&dummy), runtime·getcallersp(&dummy));
+ save(pc, sp);
}
// Goroutines must not split stacks in Gsyscall status (it would corrupt g->sched).
@@ -1548,6 +1548,13 @@ void
m->locks--;
}
+#pragma textflag NOSPLIT
+void
+·entersyscall(int32 dummy)
+{
+ runtime·reentersyscall(runtime·getcallerpc(&dummy), runtime·getcallersp(&dummy));
+}
+
// The same as runtime·entersyscall(), but with a hint that the syscall is blocking.
#pragma textflag NOSPLIT
void
@@ -1588,10 +1595,13 @@ void
// from the low-level system calls used by the runtime.
#pragma textflag NOSPLIT
void
-runtime·exitsyscall(void)
+·exitsyscall(int32 dummy)
{
m->locks++; // see comment in entersyscall
+ if(runtime·getcallersp(&dummy) > g->syscallsp)
+ runtime·throw("exitsyscall: syscall frame is no longer valid");
+
if(g->isbackground) // do not consider blocked scavenger for deadlock detection
incidlelocked(-1);