]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.power64] runtime: changes to the portable part for linux/power64 and linux/power64le
authorShenghou Ma <minux@golang.org>
Tue, 12 Aug 2014 23:49:52 +0000 (19:49 -0400)
committerShenghou Ma <minux@golang.org>
Tue, 12 Aug 2014 23:49:52 +0000 (19:49 -0400)
LGTM=rsc
R=rsc, iant
CC=golang-codereviews
https://golang.org/cl/121580044

src/pkg/runtime/cgocall.c
src/pkg/runtime/panic.c
src/pkg/runtime/proc.c
src/pkg/runtime/stack.c

index aa4cf5ee5266dcacb8b724af94c9472dff815237..2149d7c7232ad3112bb6dab07763f89d31ad2e25 100644 (file)
@@ -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
index af8bb1bc0e5924952c3c0e6e9c1e73c7279a08b4..748c4174bb2780d24cf127dce52f0d9ce8341969 100644 (file)
@@ -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
index 26e687e3b430f58a413c9f37aaa0625bef11d165..23513e1a7ba0dd18ecb2cac0d87c963263c85aa9 100644 (file)
@@ -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;
index 0a806e8fabbae9785652311d52775fb4fdcf4b59..49ecd6cc3614004d5cc9fe3ffbeabfe5c79b1074 100644 (file)
@@ -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;