mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-08 12:18:31 +00:00
Improve memory manager and signal handling
On Windows, mmap() now chooses addresses transactionally. It reduces the risk of badness when interacting with the WIN32 memory manager. We don't throw darts anymore. There is also no more retry limit, since we recover from mystery maps more gracefully. The subroutine for combining adjacent maps has been rewritten for clarity. The print maps subroutine is better This change goes to great lengths to perfect the stack overflow code. On Windows you can now longjmp() out of a crash signal handler. Guard pages previously weren't being restored properly by the signal handler. That's fixed, so on Windows you can now handle a stack overflow multiple times. Great thought has been put into selecting the perfect SIGSTKSZ constants so you can save sigaltstack() memory. You can now use kprintf() with 512 bytes of stack available. The guard pages beneath the main stack are now recorded in the memory manager. This change fixes getcontext() so it works right with the %rax register.
This commit is contained in:
parent
36e5861b0c
commit
379cd77078
48 changed files with 834 additions and 570 deletions
|
@ -1104,8 +1104,8 @@ syscon limits _ARG_MAX 128*1024 128*1024 1024*1024 1024*1024 512*1024 51
|
|||
syscon limits _NAME_MAX 255 255 255 255 255 255 511 255 # probably higher on windows?
|
||||
syscon limits _PATH_MAX 4096 4096 1024 1024 1024 1024 1024 260 #
|
||||
syscon limits _NSIG 64 64 32 32 128 32 64 64 # _SIG_MAXSIG on FreeBSD
|
||||
syscon limits _MINSIGSTKSZ 2048 2048 32768 32768 4096 12288 8192 2048 #
|
||||
syscon limits _SIGSTKSZ 8192 2048 131072 131072 36864 28672 40960 8192 #
|
||||
syscon limits _MINSIGSTKSZ 2048 6144 8192 32768 6656 14336 8192 2048 # FreeBSD upscaled a bit for ARM
|
||||
syscon limits _SIGSTKSZ 10240 10240 131072 131072 36864 28672 40960 10240 #
|
||||
|
||||
# unmount() flags
|
||||
# a.k.a. umount2() on linux
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon limits,_MINSIGSTKSZ,2048,2048,32768,32768,4096,12288,8192,2048
|
||||
.syscon limits,_MINSIGSTKSZ,2048,6144,8192,32768,6656,14336,8192,2048
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon limits,_SIGSTKSZ,8192,2048,131072,131072,36864,28672,40960,8192
|
||||
.syscon limits,_SIGSTKSZ,10240,10240,131072,131072,36864,28672,40960,10240
|
||||
|
|
|
@ -2,45 +2,25 @@
|
|||
#define COSMOPOLITAN_LIBC_SYSV_CONSTS_SIG_H_
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
extern const int SIGABRT;
|
||||
extern const int SIGALRM;
|
||||
extern const int SIGBUS;
|
||||
extern const int SIGTHR;
|
||||
extern const int SIGCHLD;
|
||||
extern const int SIGCONT;
|
||||
extern const int SIGEMT;
|
||||
extern const int SIGFPE;
|
||||
extern const int SIGHUP;
|
||||
extern const int SIGILL;
|
||||
extern const int SIGINFO;
|
||||
extern const int SIGINT;
|
||||
extern const int SIGIO;
|
||||
extern const int SIGIOT;
|
||||
extern const int SIGKILL;
|
||||
extern const int SIGPIPE;
|
||||
extern const int SIGPOLL;
|
||||
extern const int SIGPROF;
|
||||
extern const int SIGPWR;
|
||||
extern const int SIGQUIT;
|
||||
extern const int SIGRTMAX;
|
||||
extern const int SIGRTMIN;
|
||||
extern const int SIGSEGV;
|
||||
extern const int SIGSTKFLT;
|
||||
extern const int SIGSTOP;
|
||||
extern const int SIGSYS;
|
||||
extern const int SIGTERM;
|
||||
extern const int SIGTRAP;
|
||||
extern const int SIGTSTP;
|
||||
extern const int SIGTTIN;
|
||||
extern const int SIGTTOU;
|
||||
extern const int SIGUNUSED;
|
||||
extern const int SIGURG;
|
||||
extern const int SIGUSR1;
|
||||
extern const int SIGUSR2;
|
||||
extern const int SIGVTALRM;
|
||||
extern const int SIGWINCH;
|
||||
extern const int SIGXCPU;
|
||||
extern const int SIGXFSZ;
|
||||
|
||||
extern const int SIG_BLOCK;
|
||||
extern const int SIG_SETMASK;
|
||||
|
|
|
@ -8,7 +8,7 @@ extern const int _MINSIGSTKSZ;
|
|||
|
||||
COSMOPOLITAN_C_END_
|
||||
|
||||
#define SIGSTKSZ 32768
|
||||
#define SIGSTKSZ 32768 /* just itself believed to be safe */
|
||||
#define MINSIGSTKSZ 32768 /* xnu defines the highest minimum */
|
||||
#define SS_ONSTACK 1
|
||||
#define SS_DISABLE SS_DISABLE
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue