Fix forgot to pass MAP_PRIVATE flag to mmap

This commit is contained in:
flysand7 2023-08-01 02:29:44 +11:00
parent 9442c41168
commit b2ae7be654
2 changed files with 5 additions and 1 deletions

View File

@ -35,11 +35,15 @@
#define _SYS_PROT_NONE 0x0 #define _SYS_PROT_NONE 0x0
#define _SYS_PROT_GROWSDOWN 0x01000000 #define _SYS_PROT_GROWSDOWN 0x01000000
#define _SYS_PROT_GROWSUP 0x02000000 #define _SYS_PROT_GROWSUP 0x02000000
#define _SYS_MAP_SHARED 0x01
#define _SYS_MAP_PRIVATE 0x02
#define _SYS_MAP_SHARED_VALIDATE 0x03
#define _SYS_MAP_FILE 0 #define _SYS_MAP_FILE 0
#define _SYS_MAP_ANONYMOUS 0x20 #define _SYS_MAP_ANONYMOUS 0x20
#define _SYS_MAP_32BIT 0x40 #define _SYS_MAP_32BIT 0x40
#define _SYS_MAP_FAILED (void *)() #define _SYS_MAP_FAILED (void *)()
#define _SYSCALL_read 0 #define _SYSCALL_read 0
#define _SYSCALL_write 1 #define _SYSCALL_write 1
#define _SYSCALL_open 2 #define _SYSCALL_open 2

View File

@ -70,7 +70,7 @@ _Noreturn static void _rt_program_exit(int code) {
} }
static _RT_Status _rt_mem_alloc(void *optional_desired_addr, u64 size, void **out_addr) { static _RT_Status _rt_mem_alloc(void *optional_desired_addr, u64 size, void **out_addr) {
void *addr = _syscall_mmap((u64)optional_desired_addr, size, _SYS_PROT_READ|_SYS_PROT_WRITE, _SYS_MAP_ANONYMOUS, -1, 0); void *addr = _syscall_mmap((u64)optional_desired_addr, size, _SYS_PROT_READ|_SYS_PROT_WRITE, _SYS_MAP_PRIVATE|_SYS_MAP_ANONYMOUS, -1, 0);
if(addr == NULL) { if(addr == NULL) {
return _RT_ERROR_GENERIC; return _RT_ERROR_GENERIC;
} }