From: Shenghou Ma Date: Tue, 12 Aug 2014 23:49:52 +0000 (-0400) Subject: [dev.power64] runtime: changes to the portable part for linux/power64 and linux/power64le X-Git-Tag: go1.5beta1~2684^2~25^2~74 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=2abf3c5583f0eda0b7f8334bd321ea16be6993a1;p=gostls13.git [dev.power64] runtime: changes to the portable part for linux/power64 and linux/power64le LGTM=rsc R=rsc, iant CC=golang-codereviews https://golang.org/cl/121580044 --- diff --git a/src/pkg/runtime/cgocall.c b/src/pkg/runtime/cgocall.c index aa4cf5ee52..2149d7c723 100644 --- a/src/pkg/runtime/cgocall.c +++ b/src/pkg/runtime/cgocall.c @@ -228,6 +228,14 @@ struct CallbackArgs #define CBARGS (CallbackArgs*)((byte*)g->m->g0->sched.sp+4*sizeof(void*)) #endif +// Unimplemented on power64 or power64le +#ifdef GOARCH_power64 +#define CBARGS (CallbackArgs*)(nil) +#endif +#ifdef GOARCH_power64le +#define CBARGS (CallbackArgs*)(nil) +#endif + void runtime·cgocallbackg1(void); #pragma textflag NOSPLIT diff --git a/src/pkg/runtime/panic.c b/src/pkg/runtime/panic.c index af8bb1bc0e..748c4174bb 100644 --- a/src/pkg/runtime/panic.c +++ b/src/pkg/runtime/panic.c @@ -86,7 +86,7 @@ runtime·deferproc(int32 siz, FuncVal *fn, ...) d = newdefer(siz); d->fn = fn; d->pc = runtime·getcallerpc(&siz); - if(thechar == '5') + if(thechar == '5' || thechar == '9') d->argp = (byte*)(&fn+2); // skip caller's saved link register else d->argp = (byte*)(&fn+1); @@ -309,7 +309,7 @@ recovery(G *gp) // (The pc we're returning to does pop pop // before it tests the return value.) // On the arm there are 2 saved LRs mixed in too. - if(thechar == '5') + if(thechar == '5' || thechar == '9') gp->sched.sp = (uintptr)argp - 4*sizeof(uintptr); else gp->sched.sp = (uintptr)argp - 2*sizeof(uintptr); @@ -514,10 +514,10 @@ runtime·canpanic(G *gp) void runtime·throw(int8 *s) { + runtime·printf("fatal error: %s\n", s); if(g->m->throwing == 0) g->m->throwing = 1; runtime·startpanic(); - runtime·printf("fatal error: %s\n", s); runtime·dopanic(0); *(int32*)0 = 0; // not reached runtime·exit(1); // even more not reached diff --git a/src/pkg/runtime/proc.c b/src/pkg/runtime/proc.c index 26e687e3b4..23513e1a7b 100644 --- a/src/pkg/runtime/proc.c +++ b/src/pkg/runtime/proc.c @@ -1833,7 +1833,7 @@ runtime·newproc(int32 siz, FuncVal* fn, ...) { byte *argp; - if(thechar == '5') + if(thechar == '5' || thechar == '9') argp = (byte*)(&fn+2); // skip caller's saved LR else argp = (byte*)(&fn+1); @@ -1880,7 +1880,7 @@ runtime·newproc1(FuncVal *fn, byte *argp, int32 narg, int32 nret, void *callerp sp = (byte*)newg->stackbase; sp -= siz; runtime·memmove(sp, argp, narg); - if(thechar == '5') { + if(thechar == '5' || thechar == '9') { // caller's LR sp -= sizeof(void*); *(void**)sp = nil; diff --git a/src/pkg/runtime/stack.c b/src/pkg/runtime/stack.c index 0a806e8fab..49ecd6cc36 100644 --- a/src/pkg/runtime/stack.c +++ b/src/pkg/runtime/stack.c @@ -969,7 +969,7 @@ runtime·newstack(void) while(dst < dstend) *dst++ = *src++; } - if(thechar == '5') { + if(thechar == '5' || thechar == '9') { // caller would have saved its LR below args. sp -= sizeof(void*); *(void**)sp = nil;