diff options
| author | Rob Pike <r@golang.org> | 2008-07-12 11:30:53 -0700 |
|---|---|---|
| committer | Rob Pike <r@golang.org> | 2008-07-12 11:30:53 -0700 |
| commit | 2da9783e2b79f0c9a05087ba014bb93d03e191ea (patch) | |
| tree | 49d2daa2c96b564d67b42b864f3364000eafd9d0 /src/runtime/runtime.c | |
| parent | 5a81d1f29fad531a639379f78d0049638449b603 (diff) | |
| download | go-2da9783e2b79f0c9a05087ba014bb93d03e191ea.tar.xz | |
preserve AX across stack jump so C routines return correct value when triggering morestack.
SVN=126935
Diffstat (limited to 'src/runtime/runtime.c')
| -rw-r--r-- | src/runtime/runtime.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/runtime/runtime.c b/src/runtime/runtime.c index 743e085e7a..f8dfa954cc 100644 --- a/src/runtime/runtime.c +++ b/src/runtime/runtime.c @@ -698,15 +698,15 @@ sys·gosched(void) // CALL sys·morestack(SB) // -int32 debug = 0; - void -morestack2(void) +oldstack(void) { Stktop *top; uint32 siz2; byte *sp; -if(debug) prints("morestack2\n"); +if(debug) prints("oldstack m->cret = "); +if(debug) sys·printpointer((void*)m->cret); +if(debug) prints("\n"); top = (Stktop*)m->curg->stackbase; @@ -723,16 +723,16 @@ if(debug) prints("morestack2\n"); m->morestack.SP = top->oldsp+8; m->morestack.PC = (byte*)(*(uint64*)(top->oldsp+8)); -if(debug) prints("morestack2 sp="); +if(debug) prints("oldstack sp="); if(debug) sys·printpointer(m->morestack.SP); if(debug) prints(" pc="); if(debug) sys·printpointer(m->morestack.PC); if(debug) prints("\n"); - gogo(&m->morestack); + gogoret(&m->morestack, m->cret); } void -morestack1(void) +newstack(void) { int32 siz1, siz2; Stktop *top; @@ -742,7 +742,7 @@ morestack1(void) siz1 = m->morearg & 0xffffffffLL; siz2 = (m->morearg>>32) & 0xffffLL; -if(debug) prints("morestack1 siz1="); +if(debug) prints("newstack siz1="); if(debug) sys·printint(siz1); if(debug) prints(" siz2="); if(debug) sys·printint(siz2); @@ -778,7 +778,7 @@ if(debug) prints("\n"); if(debug) prints("fn="); if(debug) sys·printpointer(fn); if(debug) prints("\n"); - setspgoto(sp, fn, morestack2); + setspgoto(sp, fn, retfromnewstack); *(int32*)345 = 123; } @@ -793,7 +793,7 @@ sys·morestack(uint64 u) g = m->g0; m->moresp = (byte*)(&u-1); - setspgoto(m->sched.SP, morestack1, nil); + setspgoto(m->sched.SP, newstack, nil); *(int32*)234 = 123; } |
