mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 05:42:29 +00:00
Increase stack size to 128k and guard size to 16k
This improves our compatibility with Apple M1.
This commit is contained in:
parent
57c0dcdc29
commit
dd04aeba1c
36 changed files with 109 additions and 125 deletions
|
@ -174,12 +174,12 @@ static errno_t pthread_create_impl(pthread_t *thread,
|
|||
pt->flags = PT_OWNSTACK;
|
||||
pt->attr.__stacksize = MAX(pt->attr.__stacksize, GetStackSize());
|
||||
pt->attr.__stacksize = _roundup2pow(pt->attr.__stacksize);
|
||||
pt->attr.__guardsize = ROUNDUP(pt->attr.__guardsize, PAGESIZE);
|
||||
if (pt->attr.__guardsize + PAGESIZE >= pt->attr.__stacksize) {
|
||||
pt->attr.__guardsize = ROUNDUP(pt->attr.__guardsize, GUARDSIZE);
|
||||
if (pt->attr.__guardsize + GUARDSIZE >= pt->attr.__stacksize) {
|
||||
_pthread_free(pt);
|
||||
return EINVAL;
|
||||
}
|
||||
if (pt->attr.__guardsize == PAGESIZE) {
|
||||
if (pt->attr.__guardsize == GUARDSIZE) {
|
||||
// user is wisely using smaller stacks with default guard size
|
||||
pt->attr.__stackaddr =
|
||||
mmap(0, pt->attr.__stacksize, PROT_READ | PROT_WRITE,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue