Skip to content

Commit

Permalink
runtime: fix windows/386 build
Browse files Browse the repository at this point in the history
The difference between the old and the new (from earlier) code
is that we set stackguard = stack.lo + StackGuard, while the old
code set stackguard = stack.lo. That 512 bytes appears to be
the difference between the profileloop function running and not running.

We don't know how big the system stack is, but it is likely MUCH bigger than 4k.
Give Go/C 8k.

TBR=iant
CC=golang-codereviews
https://golang.org/cl/140440044
  • Loading branch information
rsc committed Sep 9, 2014
1 parent 16c59ac commit ee6c6d9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/runtime/memclr_386.s
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

#include "textflag.h"

// NOTE: Windows externalthreadhandler expects memclr to preserve DX.

// void runtime·memclr(void*, uintptr)
TEXT runtime·memclr(SB), NOSPLIT, $0-8
MOVL ptr+0(FP), DI
Expand Down
2 changes: 2 additions & 0 deletions src/runtime/memclr_amd64.s
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

#include "textflag.h"

// NOTE: Windows externalthreadhandler expects memclr to preserve DX.

// void runtime·memclr(void*, uintptr)
TEXT runtime·memclr(SB), NOSPLIT, $0-16
MOVQ ptr+0(FP), DI
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/sys_windows_386.s
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ TEXT runtime·externalthreadhandler(SB),NOSPLIT,$0
CALL runtime·memclr(SB) // smashes AX,BX,CX
LEAL g_end(SP), BX
MOVL BX, g_m(SP)
LEAL -4096(SP), CX
LEAL -8192(SP), CX
MOVL CX, (g_stack+stack_lo)(SP)
ADDL $const_StackGuard, CX
MOVL CX, g_stackguard0(SP)
Expand Down

0 comments on commit ee6c6d9

Please sign in to comment.