mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-16 15:40:31 +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
|
@ -153,6 +153,7 @@
|
|||
(defconst cosmo-cpp-constants-cosmopolitan
|
||||
'("__SAUCE__"
|
||||
"PAGESIZE"
|
||||
"GUARDSIZE"
|
||||
"FRAMESIZE"
|
||||
"BIGPAGESIZE"
|
||||
"STACKSIZE"
|
||||
|
|
|
@ -98,7 +98,7 @@ static struct DecodeJson Parse(struct lua_State *L, const char *p,
|
|||
if (UNLIKELY(!depth)) {
|
||||
return (struct DecodeJson){-1, "maximum depth exceeded"};
|
||||
}
|
||||
if (UNLIKELY(!HaveStackMemory(PAGESIZE))) {
|
||||
if (UNLIKELY(!HaveStackMemory(GUARDSIZE))) {
|
||||
return (struct DecodeJson){-1, "out of stack"};
|
||||
}
|
||||
for (a = p, d = +1; p < e;) {
|
||||
|
|
|
@ -481,17 +481,17 @@ static void *NewBoard(size_t *out_size) {
|
|||
char *p;
|
||||
size_t s, n, k;
|
||||
s = (byn * bxn) >> 3;
|
||||
k = PAGESIZE + ROUNDUP(s, PAGESIZE);
|
||||
n = ROUNDUP(k + PAGESIZE, FRAMESIZE);
|
||||
k = GUARDSIZE + ROUNDUP(s, GUARDSIZE);
|
||||
n = ROUNDUP(k + GUARDSIZE, FRAMESIZE);
|
||||
p = _mapanon(n);
|
||||
mprotect(p, PAGESIZE, 0);
|
||||
mprotect(p, GUARDSIZE, 0);
|
||||
mprotect(p + k, n - k, 0);
|
||||
if (out_size) *out_size = n;
|
||||
return p + PAGESIZE;
|
||||
return p + GUARDSIZE;
|
||||
}
|
||||
|
||||
static void FreeBoard(void *p, size_t n) {
|
||||
munmap((char *)p - PAGESIZE, n);
|
||||
munmap((char *)p - GUARDSIZE, n);
|
||||
}
|
||||
|
||||
static void AllocateBoardsWithHardwareAcceleratedMemorySafety(void) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue