From ced760b64147d6c9e41619dd1c51626ff770d9ad Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Thu, 4 Mar 2010 15:34:25 -0800 Subject: cc: disallow ... argument unless NOSPLIT is set. check that NOSPLIT functions don't use too much stack. correct some missing NOSPLITs in the runtime library. Fixes bug reported in https://groups.google.com/group/golang-nuts/t/efff68b73941eccf R=ken2 CC=golang-dev http://codereview.appspot.com/236041 --- src/pkg/runtime/proc.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/pkg/runtime/proc.c') diff --git a/src/pkg/runtime/proc.c b/src/pkg/runtime/proc.c index 9b4e34f6f..c85e347e2 100644 --- a/src/pkg/runtime/proc.c +++ b/src/pkg/runtime/proc.c @@ -666,6 +666,7 @@ oldstack(void) uint32 args; byte *sp; G *g1; + static int32 goid; //printf("oldstack m->cret=%p\n", m->cret); @@ -678,6 +679,7 @@ oldstack(void) sp -= args; mcpy(top->fp, sp, args); } + goid = old.gobuf.g->goid; // fault if g is bad, before gogo stackfree(g1->stackguard - StackGuard); g1->stackbase = old.stackbase; @@ -765,9 +767,9 @@ malg(int32 stacksize) */ #pragma textflag 7 void -·newproc(int32 siz, byte* fn, byte* arg0) +·newproc(int32 siz, byte* fn, ...) { - newproc1(fn, (byte*)&arg0, siz, 0); + newproc1(fn, (byte*)(&fn+1), siz, 0); } void @@ -815,13 +817,13 @@ newproc1(byte *fn, byte *argp, int32 narg, int32 nret) #pragma textflag 7 void -·deferproc(int32 siz, byte* fn, byte* arg0) +·deferproc(int32 siz, byte* fn, ...) { Defer *d; d = malloc(sizeof(*d) + siz - sizeof(d->args)); d->fn = fn; - d->sp = (byte*)&arg0; + d->sp = (byte*)(&fn+1); d->siz = siz; mcpy(d->args, d->sp, d->siz); -- cgit v1.2.3