Merge pull request #242 from hyc/vmem2

Fix previous commit...
This commit is contained in:
hyc 2022-05-09 17:49:19 +01:00 committed by GitHub
commit 8b1df47e42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -145,7 +145,7 @@ void* allocMemoryPages(size_t bytes) {
#if defined(USE_PTHREAD_JIT_WP) && defined(MAC_OS_VERSION_11_0) \
&& MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_VERSION_11_0
if (__builtin_available(macOS 11.0, *)) {
pthread_jit_write_protect_np(false);
pthread_jit_write_protect_np(0);
}
#endif
#endif
@ -170,7 +170,7 @@ void setPagesRW(void* ptr, size_t bytes) {
#if defined(USE_PTHREAD_JIT_WP) && defined(MAC_OS_VERSION_11_0) \
&& MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_VERSION_11_0
if (__builtin_available(macOS 11.0, *)) {
pthread_jit_write_protect_np(false);
pthread_jit_write_protect_np(0);
} else {
pageProtect(ptr, bytes, PAGE_READWRITE, &errfunc);
}
@ -184,7 +184,7 @@ void setPagesRX(void* ptr, size_t bytes) {
#if defined(USE_PTHREAD_JIT_WP) && defined(MAC_OS_VERSION_11_0) \
&& MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_VERSION_11_0
if (__builtin_available(macOS 11.0, *)) {
pthread_jit_write_protect_np(true);
pthread_jit_write_protect_np(1);
} else {
pageProtect(ptr, bytes, PAGE_EXECUTE_READ, &errfunc);
}