1
0
mirror of https://github.com/golang/go synced 2024-11-19 13:04:45 -07:00

runtime: fix build failures after CL 137410043

No promise about correctness, but they do build.

TBR=khr
CC=golang-codereviews
https://golang.org/cl/143720043
This commit is contained in:
Russ Cox 2014-09-09 14:02:37 -04:00
parent 15b76ad94b
commit 8ac35be145
9 changed files with 36 additions and 19 deletions

View File

@ -811,7 +811,7 @@ TEXT setg_gcc<>(SB), NOSPLIT, $0
MOVL DX, g(AX) MOVL DX, g(AX)
RET RET
// check that SP is in range [g->stackbase, g->stackguard) // check that SP is in range [g->stack.lo, g->stack.hi)
TEXT runtime·stackcheck(SB), NOSPLIT, $0-0 TEXT runtime·stackcheck(SB), NOSPLIT, $0-0
get_tls(CX) get_tls(CX)
MOVL g(CX), AX MOVL g(CX), AX

View File

@ -590,7 +590,7 @@ TEXT runtime·setg(SB), NOSPLIT, $0-4
MOVL 0, AX MOVL 0, AX
RET RET
// check that SP is in range [g->stackbase, g->stackguard) // check that SP is in range [g->stack.lo, g->stack.hi)
TEXT runtime·stackcheck(SB), NOSPLIT, $0-0 TEXT runtime·stackcheck(SB), NOSPLIT, $0-0
get_tls(CX) get_tls(CX)
MOVL g(CX), AX MOVL g(CX), AX

View File

@ -153,8 +153,8 @@ runtime·newosproc(M *mp, void *stk)
// NOTE(rsc): This code is confused. stackbase is the top of the stack // NOTE(rsc): This code is confused. stackbase is the top of the stack
// and is equal to stk. However, it's working, so I'm not changing it. // and is equal to stk. However, it's working, so I'm not changing it.
param.stack_base = (void*)mp->g0->stackbase; param.stack_base = (void*)mp->g0->stack.hi;
param.stack_size = (byte*)stk - (byte*)mp->g0->stackbase; param.stack_size = (byte*)stk - (byte*)mp->g0->stack.hi;
param.child_tid = (void*)&mp->procid; param.child_tid = (void*)&mp->procid;
param.parent_tid = nil; param.parent_tid = nil;

View File

@ -121,14 +121,17 @@ runtime·newosproc(M *mp, void *stk)
Sigset oset; Sigset oset;
Pthread tid; Pthread tid;
int32 ret; int32 ret;
uint64 size;
USED(stk); USED(stk);
if(runtime·pthread_attr_init(&attr) != 0) if(runtime·pthread_attr_init(&attr) != 0)
runtime·throw("pthread_attr_init"); runtime·throw("pthread_attr_init");
if(runtime·pthread_attr_setstack(&attr, 0, 0x200000) != 0) if(runtime·pthread_attr_setstack(&attr, 0, 0x200000) != 0)
runtime·throw("pthread_attr_setstack"); runtime·throw("pthread_attr_setstack");
if(runtime·pthread_attr_getstack(&attr, (void**)&mp->g0->stackbase, &mp->g0->stacksize) != 0) size = 0;
if(runtime·pthread_attr_getstack(&attr, (void**)&mp->g0->stack.hi, &size) != 0)
runtime·throw("pthread_attr_getstack"); runtime·throw("pthread_attr_getstack");
mp->g0->stack.lo = mp->g0->stack.hi - size;
if(runtime·pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED) != 0) if(runtime·pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED) != 0)
runtime·throw("pthread_attr_setdetachstate"); runtime·throw("pthread_attr_setdetachstate");

View File

@ -192,7 +192,7 @@ TEXT runtime·sigtramp(SB),NOSPLIT,$0
// change stack // change stack
MOVL g_m(BX), BX MOVL g_m(BX), BX
MOVL m_gsignal(BX), BP MOVL m_gsignal(BX), BP
MOVL g_stackbase(BP), BP MOVL (g_stack+stack_hi)(BP), BP
MOVL BP, SP MOVL BP, SP
// make room for args and g // make room for args and g

View File

@ -190,7 +190,7 @@ TEXT runtime·sigtramp(SB),NOSPLIT,$0
// change stack // change stack
MOVQ g_m(BX), BX MOVQ g_m(BX), BX
MOVQ m_gsignal(BX), R10 MOVQ m_gsignal(BX), R10
MOVQ g_stackbase(R10), BP MOVQ (g_stack+stack_hi)(R10), BP
MOVQ BP, SP MOVQ BP, SP
// make room for args and g // make room for args and g

View File

@ -129,10 +129,12 @@ TEXT runtime·tstart_sysvicall(SB),NOSPLIT,$0
// Layout new m scheduler stack on os stack. // Layout new m scheduler stack on os stack.
MOVQ SP, AX MOVQ SP, AX
MOVQ AX, g_stackbase(DX) MOVQ AX, (g_stack+stack_hi)(DX)
SUBQ $(0x100000), AX // stack size SUBQ $(0x100000), AX // stack size
MOVQ AX, g_stackguard(DX) MOVQ AX, (g_stack+stack_lo)(DX)
ADDQ $const_StackGuard, AX
MOVQ AX, g_stackguard0(DX) MOVQ AX, g_stackguard0(DX)
MOVQ AX, g_stackguard1(DX)
// Someday the convention will be D is always cleared. // Someday the convention will be D is always cleared.
CLD CLD

View File

@ -192,8 +192,11 @@ TEXT runtime·externalthreadhandler(SB),NOSPLIT,$0
LEAL g_end(SP), BX LEAL g_end(SP), BX
MOVL BX, g_m(SP) MOVL BX, g_m(SP)
LEAL -4096(SP), CX LEAL -4096(SP), CX
MOVL CX, g_stackguard(SP) MOVL CX, (g_stack+stack_lo)(SP)
MOVL DX, g_stackbase(SP) ADDL $const_StackGuard, CX
MOVL CX, g_stackguard0(SP)
MOVL CX, g_stackguard1(SP)
MOVL DX, (g_stack+stack_hi)(SP)
PUSHL 16(BP) // arg for handler PUSHL 16(BP) // arg for handler
CALL 8(BP) CALL 8(BP)
@ -201,7 +204,7 @@ TEXT runtime·externalthreadhandler(SB),NOSPLIT,$0
get_tls(CX) get_tls(CX)
MOVL g(CX), CX MOVL g(CX), CX
MOVL g_stackbase(CX), SP MOVL (g_stack+stack_hi)(CX), SP
POPL 0x14(FS) POPL 0x14(FS)
POPL DI POPL DI
POPL SI POPL SI
@ -293,9 +296,12 @@ TEXT runtime·tstart(SB),NOSPLIT,$0
// Layout new m scheduler stack on os stack. // Layout new m scheduler stack on os stack.
MOVL SP, AX MOVL SP, AX
MOVL AX, g_stackbase(DX) MOVL AX, (g_stack+stack_hi)(DX)
SUBL $(64*1024), AX // stack size SUBL $(64*1024), AX // stack size
MOVL AX, g_stackguard(DX) MOVL AX, (g_stack+stack_lo)(DX)
ADDL $const_StackGuard, AX
MOVL AX, g_stackguard0(DX)
MOVL AX, g_stackguard1(DX)
// Set up tls. // Set up tls.
LEAL m_tls(CX), SI LEAL m_tls(CX), SI

View File

@ -229,8 +229,11 @@ TEXT runtime·externalthreadhandler(SB),NOSPLIT,$0
MOVQ BX, g_m(SP) MOVQ BX, g_m(SP)
LEAQ -8192(SP), CX LEAQ -8192(SP), CX
MOVQ CX, g_stackguard(SP) MOVQ CX, (g_stack+stack_lo)(SP)
MOVQ DX, g_stackbase(SP) ADDQ $const_StackGuard, CX
MOVQ CX, g_stackguard0(SP)
MOVQ CX, g_stackguard1(SP)
MOVQ DX, (g_stack+stack_hi)(SP)
PUSHQ 32(BP) // arg for handler PUSHQ 32(BP) // arg for handler
CALL 16(BP) CALL 16(BP)
@ -238,7 +241,7 @@ TEXT runtime·externalthreadhandler(SB),NOSPLIT,$0
get_tls(CX) get_tls(CX)
MOVQ g(CX), CX MOVQ g(CX), CX
MOVQ g_stackbase(CX), SP MOVQ (g_stack+stack_hi)(CX), SP
POPQ 0x28(GS) POPQ 0x28(GS)
POPQ DI POPQ DI
POPQ SI POPQ SI
@ -334,9 +337,12 @@ TEXT runtime·tstart_stdcall(SB),NOSPLIT,$0
// Layout new m scheduler stack on os stack. // Layout new m scheduler stack on os stack.
MOVQ SP, AX MOVQ SP, AX
MOVQ AX, g_stackbase(DX) MOVQ AX, (g_stack+stack_hi)(DX)
SUBQ $(64*1024), AX // stack size SUBQ $(64*1024), AX // stack size
MOVQ AX, g_stackguard(DX) MOVQ AX, (g_stack+stack_lo)(DX)
ADDQ $const_StackGuard, AX
MOVQ AX, g_stackguard0(DX)
MOVQ AX, g_stackguard1(DX)
// Set up tls. // Set up tls.
LEAQ m_tls(CX), SI LEAQ m_tls(CX), SI