Commit 8a7597fd authored by Russ Cox's avatar Russ Cox

runtime: fix nacl/amd64p32 build

Update #8675
Fixes nacl/amd64p32 build.

TBR=khr
CC=golang-codereviews
https://golang.org/cl/141140045
parent 59dd20f4
...@@ -483,11 +483,19 @@ addstacksplit(Link *ctxt, LSym *cursym) ...@@ -483,11 +483,19 @@ addstacksplit(Link *ctxt, LSym *cursym)
p->from.type = D_INDIR+D_CX; p->from.type = D_INDIR+D_CX;
p->from.offset = 2*ctxt->arch->ptrsize; // G.panic p->from.offset = 2*ctxt->arch->ptrsize; // G.panic
p->to.type = D_BX; p->to.type = D_BX;
if(ctxt->headtype == Hnacl) {
p->as = AMOVL;
p->from.type = D_INDIR+D_R15;
p->from.scale = 1;
p->from.index = D_CX;
}
p = appendp(ctxt, p); p = appendp(ctxt, p);
p->as = ATESTQ; p->as = ATESTQ;
p->from.type = D_BX; p->from.type = D_BX;
p->to.type = D_BX; p->to.type = D_BX;
if(ctxt->headtype == Hnacl)
p->as = ATESTL;
p = appendp(ctxt, p); p = appendp(ctxt, p);
p->as = AJEQ; p->as = AJEQ;
...@@ -499,12 +507,20 @@ addstacksplit(Link *ctxt, LSym *cursym) ...@@ -499,12 +507,20 @@ addstacksplit(Link *ctxt, LSym *cursym)
p->from.type = D_INDIR+D_SP; p->from.type = D_INDIR+D_SP;
p->from.offset = autoffset+8; p->from.offset = autoffset+8;
p->to.type = D_DI; p->to.type = D_DI;
if(ctxt->headtype == Hnacl)
p->as = ALEAL;
p = appendp(ctxt, p); p = appendp(ctxt, p);
p->as = ACMPQ; p->as = ACMPQ;
p->from.type = D_INDIR+D_BX; p->from.type = D_INDIR+D_BX;
p->from.offset = 0; // Panic.argp p->from.offset = 0; // Panic.argp
p->to.type = D_DI; p->to.type = D_DI;
if(ctxt->headtype == Hnacl) {
p->as = ACMPL;
p->from.type = D_INDIR+D_R15;
p->from.scale = 1;
p->from.index = D_BX;
}
p = appendp(ctxt, p); p = appendp(ctxt, p);
p->as = AJNE; p->as = AJNE;
...@@ -516,6 +532,12 @@ addstacksplit(Link *ctxt, LSym *cursym) ...@@ -516,6 +532,12 @@ addstacksplit(Link *ctxt, LSym *cursym)
p->from.type = D_SP; p->from.type = D_SP;
p->to.type = D_INDIR+D_BX; p->to.type = D_INDIR+D_BX;
p->to.offset = 0; // Panic.argp p->to.offset = 0; // Panic.argp
if(ctxt->headtype == Hnacl) {
p->as = AMOVL;
p->to.type = D_INDIR+D_R15;
p->to.scale = 1;
p->to.index = D_BX;
}
p = appendp(ctxt, p); p = appendp(ctxt, p);
p->as = ANOP; p->as = ANOP;
......
...@@ -281,7 +281,7 @@ TEXT runtime·morestack(SB),NOSPLIT,$0-0 ...@@ -281,7 +281,7 @@ TEXT runtime·morestack(SB),NOSPLIT,$0-0
RET RET
// reflect·call: call a function with the given argument list // reflect·call: call a function with the given argument list
// func call(f *FuncVal, arg *byte, argsize, retoffset uint32, p *Panic). // func call(f *FuncVal, arg *byte, argsize, retoffset uint32).
// we don't have variable-sized frames, so we use a small number // we don't have variable-sized frames, so we use a small number
// of constant-sized-frame functions to encode a few bits of size in the pc. // of constant-sized-frame functions to encode a few bits of size in the pc.
// Caution: ugly multiline assembly macros in your future! // Caution: ugly multiline assembly macros in your future!
...@@ -293,7 +293,7 @@ TEXT runtime·morestack(SB),NOSPLIT,$0-0 ...@@ -293,7 +293,7 @@ TEXT runtime·morestack(SB),NOSPLIT,$0-0
JMP AX JMP AX
// Note: can't just "JMP NAME(SB)" - bad inlining results. // Note: can't just "JMP NAME(SB)" - bad inlining results.
TEXT reflect·call(SB), NOSPLIT, $0-20 TEXT reflect·call(SB), NOSPLIT, $0-16
MOVLQZX argsize+8(FP), CX MOVLQZX argsize+8(FP), CX
DISPATCH(runtime·call16, 16) DISPATCH(runtime·call16, 16)
DISPATCH(runtime·call32, 32) DISPATCH(runtime·call32, 32)
...@@ -338,7 +338,7 @@ DATA gclocals_reflectcall<>+0x04(SB)/4, $0 // 0 locals ...@@ -338,7 +338,7 @@ DATA gclocals_reflectcall<>+0x04(SB)/4, $0 // 0 locals
GLOBL gclocals_reflectcall<>(SB),RODATA,$8 GLOBL gclocals_reflectcall<>(SB),RODATA,$8
#define CALLFN(NAME,MAXSIZE) \ #define CALLFN(NAME,MAXSIZE) \
TEXT NAME(SB), WRAPPER, $MAXSIZE-20; \ TEXT NAME(SB), WRAPPER, $MAXSIZE-16; \
FUNCDATA $FUNCDATA_ArgsPointerMaps,gcargs_reflectcall<>(SB); \ FUNCDATA $FUNCDATA_ArgsPointerMaps,gcargs_reflectcall<>(SB); \
FUNCDATA $FUNCDATA_LocalsPointerMaps,gclocals_reflectcall<>(SB);\ FUNCDATA $FUNCDATA_LocalsPointerMaps,gclocals_reflectcall<>(SB);\
/* copy arguments to stack */ \ /* copy arguments to stack */ \
...@@ -346,20 +346,10 @@ TEXT NAME(SB), WRAPPER, $MAXSIZE-20; \ ...@@ -346,20 +346,10 @@ TEXT NAME(SB), WRAPPER, $MAXSIZE-20; \
MOVL argsize+8(FP), CX; \ MOVL argsize+8(FP), CX; \
MOVL SP, DI; \ MOVL SP, DI; \
REP;MOVSB; \ REP;MOVSB; \
/* initialize panic argp */ \
MOVL panic+16(FP), CX; \
CMPL CX, $0; \
JEQ 2(PC); \
MOVL SP, panic_argp(CX); \
/* call function */ \ /* call function */ \
MOVL f+0(FP), DX; \ MOVL f+0(FP), DX; \
MOVL (DX), AX; \ MOVL (DX), AX; \
CALL AX; \ CALL AX; \
/* clear panic argp */ \
MOVL panic+16(FP), CX; \
CMPL CX, $0; \
JEQ 2(PC); \
MOVL $0, panic_argp(CX); \
/* copy return values back */ \ /* copy return values back */ \
MOVL argptr+4(FP), DI; \ MOVL argptr+4(FP), DI; \
MOVL argsize+8(FP), CX; \ MOVL argsize+8(FP), CX; \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment