mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-03-02 23:18:44 +00:00
Increase Windows stack size (#32)
We're now using the same values CMD.EXE uses.
This commit is contained in:
parent
95173645a1
commit
393a642c22
2 changed files with 6 additions and 4 deletions
|
@ -783,8 +783,8 @@ ape.pe: .ascin "PE",4
|
|||
.long 0 # Checksum
|
||||
.short v_ntsubsystem # Subsystem: 0=Neutral,2=GUI,3=Console
|
||||
.short .LDLLEXE # DllCharacteristics
|
||||
.quad 0x0000000000020000 # StackReserve
|
||||
.quad 0x0000000000020000 # StackCommit
|
||||
.quad 0x0000000000100000 # StackReserve
|
||||
.quad 0x00000000000fc000 # StackCommit
|
||||
.quad 0 # HeapReserve
|
||||
.quad 0 # HeapCommit
|
||||
.long 0 # LoaderFlags
|
||||
|
|
|
@ -49,6 +49,8 @@
|
|||
* TODO: How can we ensure we never overlap with KERNEL32.DLL?
|
||||
*/
|
||||
|
||||
#define WINSTACK 0x100000
|
||||
|
||||
struct WinArgs {
|
||||
char *argv[4096];
|
||||
char *envp[4096];
|
||||
|
@ -107,7 +109,7 @@ static textwindows wontreturn void WinMainNew(void) {
|
|||
NormalizeCmdExe();
|
||||
*(/*unconst*/ int *)&__hostos = WINDOWS;
|
||||
addr = NtGetVersion() < kNtVersionWindows10 ? 0xff00000 : 0x777000000000;
|
||||
size = ROUNDUP(STACKSIZE + sizeof(struct WinArgs), FRAMESIZE);
|
||||
size = ROUNDUP(WINSTACK + sizeof(struct WinArgs), FRAMESIZE);
|
||||
_mmi.p[0].h =
|
||||
__mmap$nt((char *)addr, size, PROT_READ | PROT_WRITE | PROT_EXEC, -1, 0)
|
||||
.maphandle;
|
||||
|
@ -128,7 +130,7 @@ static textwindows wontreturn void WinMainNew(void) {
|
|||
FreeEnvironmentStrings(env16);
|
||||
auxv[0][0] = pushpop(0L);
|
||||
auxv[0][1] = pushpop(0L);
|
||||
_jmpstack((char *)addr + STACKSIZE, _executive, count, wa->argv, wa->envp,
|
||||
_jmpstack((char *)addr + WINSTACK, _executive, count, wa->argv, wa->envp,
|
||||
auxv);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue