1
0
mirror of https://github.com/golang/go synced 2024-10-04 08:31:22 -06:00

[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
This commit is contained in:
Shenghou Ma 2014-08-12 19:49:52 -04:00
parent f2d43ec7cd
commit 2abf3c5583
4 changed files with 14 additions and 6 deletions

View File

@ -228,6 +228,14 @@ struct CallbackArgs
#define CBARGS (CallbackArgs*)((byte*)g->m->g0->sched.sp+4*sizeof(void*)) #define CBARGS (CallbackArgs*)((byte*)g->m->g0->sched.sp+4*sizeof(void*))
#endif #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); void runtime·cgocallbackg1(void);
#pragma textflag NOSPLIT #pragma textflag NOSPLIT

View File

@ -86,7 +86,7 @@ runtime·deferproc(int32 siz, FuncVal *fn, ...)
d = newdefer(siz); d = newdefer(siz);
d->fn = fn; d->fn = fn;
d->pc = runtime·getcallerpc(&siz); d->pc = runtime·getcallerpc(&siz);
if(thechar == '5') if(thechar == '5' || thechar == '9')
d->argp = (byte*)(&fn+2); // skip caller's saved link register d->argp = (byte*)(&fn+2); // skip caller's saved link register
else else
d->argp = (byte*)(&fn+1); d->argp = (byte*)(&fn+1);
@ -309,7 +309,7 @@ recovery(G *gp)
// (The pc we're returning to does pop pop // (The pc we're returning to does pop pop
// before it tests the return value.) // before it tests the return value.)
// On the arm there are 2 saved LRs mixed in too. // 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); gp->sched.sp = (uintptr)argp - 4*sizeof(uintptr);
else else
gp->sched.sp = (uintptr)argp - 2*sizeof(uintptr); gp->sched.sp = (uintptr)argp - 2*sizeof(uintptr);
@ -514,10 +514,10 @@ runtime·canpanic(G *gp)
void void
runtime·throw(int8 *s) runtime·throw(int8 *s)
{ {
runtime·printf("fatal error: %s\n", s);
if(g->m->throwing == 0) if(g->m->throwing == 0)
g->m->throwing = 1; g->m->throwing = 1;
runtime·startpanic(); runtime·startpanic();
runtime·printf("fatal error: %s\n", s);
runtime·dopanic(0); runtime·dopanic(0);
*(int32*)0 = 0; // not reached *(int32*)0 = 0; // not reached
runtime·exit(1); // even more not reached runtime·exit(1); // even more not reached

View File

@ -1833,7 +1833,7 @@ runtime·newproc(int32 siz, FuncVal* fn, ...)
{ {
byte *argp; byte *argp;
if(thechar == '5') if(thechar == '5' || thechar == '9')
argp = (byte*)(&fn+2); // skip caller's saved LR argp = (byte*)(&fn+2); // skip caller's saved LR
else else
argp = (byte*)(&fn+1); 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 = (byte*)newg->stackbase;
sp -= siz; sp -= siz;
runtime·memmove(sp, argp, narg); runtime·memmove(sp, argp, narg);
if(thechar == '5') { if(thechar == '5' || thechar == '9') {
// caller's LR // caller's LR
sp -= sizeof(void*); sp -= sizeof(void*);
*(void**)sp = nil; *(void**)sp = nil;

View File

@ -969,7 +969,7 @@ runtime·newstack(void)
while(dst < dstend) while(dst < dstend)
*dst++ = *src++; *dst++ = *src++;
} }
if(thechar == '5') { if(thechar == '5' || thechar == '9') {
// caller would have saved its LR below args. // caller would have saved its LR below args.
sp -= sizeof(void*); sp -= sizeof(void*);
*(void**)sp = nil; *(void**)sp = nil;