mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-28 05:20:28 +00:00
Improve dlopen() on Apple Silicon
- Introduce MAP_JIT which is zero on other platforms - Invent __jit_begin() and __jit_end() which wrap Apple's APIs - Runtime dispatch to sys_icache_invalidate() in __clear_cache()
This commit is contained in:
parent
7a9e176ecf
commit
529cb4817c
20 changed files with 120 additions and 117 deletions
|
@ -21,6 +21,7 @@
|
|||
#include "libc/intrin/describeflags.internal.h"
|
||||
#include "libc/intrin/directmap.internal.h"
|
||||
#include "libc/intrin/strace.internal.h"
|
||||
#include "libc/runtime/syslib.internal.h"
|
||||
|
||||
/**
|
||||
* Unmaps memory directly with system.
|
||||
|
@ -32,10 +33,12 @@
|
|||
*/
|
||||
int sys_munmap(void *p, size_t n) {
|
||||
int rc;
|
||||
if (!IsMetal()) {
|
||||
rc = __sys_munmap(p, n);
|
||||
} else {
|
||||
if (IsXnuSilicon()) {
|
||||
rc = _sysret(__syslib->__munmap(p, n));
|
||||
} else if (IsMetal()) {
|
||||
rc = sys_munmap_metal(p, n);
|
||||
} else {
|
||||
rc = __sys_munmap(p, n);
|
||||
}
|
||||
KERNTRACE("sys_munmap(%p /* %s */, %'zu) → %d", p,
|
||||
DescribeFrame((intptr_t)p >> 16), n, rc);
|
||||
|
|
|
@ -20,6 +20,7 @@ i32 __sys_fcntl_cp(i32, i32, ...);
|
|||
i32 __sys_fstat(i32, void *);
|
||||
i32 __sys_fstatat(i32, const char *, void *, i32);
|
||||
i32 __sys_gettid(i64 *);
|
||||
i32 __sys_mprotect(void *, u64, i32);
|
||||
i32 __sys_munmap(void *, u64);
|
||||
i32 __sys_openat(i32, const char *, i32, u32);
|
||||
i32 __sys_openat_nc(i32, const char *, i32, u32);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue