X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=deps%2Flightning%2Fcheck%2Fsetcode.c;h=08611d960767f0c021dce417d69221655f5d8c95;hb=02a5662c31c401081716623cc80bb1c4ab1dbb19;hp=62719eefae79be49f02074b836036e8379047e3e;hpb=c0c162422385a60ea7c8fa1dfe439e83e0a13d88;p=pcsx_rearmed.git diff --git a/deps/lightning/check/setcode.c b/deps/lightning/check/setcode.c index 62719eef..08611d96 100644 --- a/deps/lightning/check/setcode.c +++ b/deps/lightning/check/setcode.c @@ -31,14 +31,14 @@ main(int argc, char *argv[]) int mmap_fd; #endif void (*function)(void); - int mmap_prot, mmap_flags; + int mmap_prot, mmap_flags, result; #if defined(__sgi) mmap_fd = open("/dev/zero", O_RDWR); #endif mmap_prot = PROT_READ | PROT_WRITE; -#if !__OpenBSD__ +#if !(__OpenBSD__ || __APPLE__) mmap_prot |= PROT_EXEC; #endif #if __NetBSD__ @@ -83,7 +83,8 @@ main(int argc, char *argv[]) abort(); #if __NetBSD__ - assert(mprotect(ptr, 1024 * 1024, PROT_READ | PROT_WRITE) == 0); + result = mprotect(ptr, 1024 * 1024, PROT_READ | PROT_WRITE); + assert(result == 0); #endif /* and calling again with enough space works */ jit_set_code(ptr, 1024 * 1024); @@ -92,8 +93,9 @@ main(int argc, char *argv[]) abort(); jit_clear_state(); -#if __NetBSD__ || __OpenBSD__ - assert(mprotect(ptr, 1024 * 1024, PROT_READ | PROT_EXEC) == 0); +#if __NetBSD__ || __OpenBSD__ || __APPLE__ + result = mprotect(ptr, 1024 * 1024, PROT_READ | PROT_EXEC); + assert(result == 0); #endif (*function)(); jit_destroy_state();