aboutsummaryrefslogtreecommitdiff
path: root/libgo/runtime/stack.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/runtime/stack.c')
-rw-r--r--libgo/runtime/stack.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/libgo/runtime/stack.c b/libgo/runtime/stack.c
index 900ca64..a971e8f 100644
--- a/libgo/runtime/stack.c
+++ b/libgo/runtime/stack.c
@@ -34,6 +34,7 @@ void doscanstack(G *gp, void* gcw) {
// Save registers on the stack, so that if we are scanning our
// own stack we will see them.
__builtin_unwind_init();
+ flush_registers_to_secondary_stack();
doscanstack1(gp, gcw);
}
@@ -82,21 +83,32 @@ static void doscanstack1(G *gp, void *gcw) {
#else
byte* bottom;
byte* top;
+ byte* nextsp2;
+ byte* initialsp2;
if(gp == runtime_g()) {
// Scanning our own stack.
bottom = (byte*)&gp;
+ nextsp2 = secondary_stack_pointer();
} else {
// Scanning another goroutine's stack.
// The goroutine is usually asleep (the world is stopped).
bottom = (void*)gp->gcnextsp;
if(bottom == nil)
return;
+ nextsp2 = (void*)gp->gcnextsp2;
}
top = (byte*)(void*)(gp->gcinitialsp) + gp->gcstacksize;
if(top > bottom)
scanstackblock(bottom, (uintptr)(top - bottom), gcw);
else
scanstackblock(top, (uintptr)(bottom - top), gcw);
+ if (nextsp2 != nil) {
+ initialsp2 = (byte*)(void*)(gp->gcinitialsp2);
+ if(initialsp2 > nextsp2)
+ scanstackblock(nextsp2, (uintptr)(initialsp2 - nextsp2), gcw);
+ else
+ scanstackblock(initialsp2, (uintptr)(nextsp2 - initialsp2), gcw);
+ }
#endif
}