diff options
Diffstat (limited to 'src/lj_mcode.c')
-rw-r--r-- | src/lj_mcode.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/lj_mcode.c b/src/lj_mcode.c index 5ea89f66..64b0ca90 100644 --- a/src/lj_mcode.c +++ b/src/lj_mcode.c | |||
@@ -66,8 +66,8 @@ void lj_mcode_sync(void *start, void *end) | |||
66 | 66 | ||
67 | static void *mcode_alloc_at(jit_State *J, uintptr_t hint, size_t sz, DWORD prot) | 67 | static void *mcode_alloc_at(jit_State *J, uintptr_t hint, size_t sz, DWORD prot) |
68 | { | 68 | { |
69 | void *p = VirtualAlloc((void *)hint, sz, | 69 | void *p = LJ_WIN_VALLOC((void *)hint, sz, |
70 | MEM_RESERVE|MEM_COMMIT|MEM_TOP_DOWN, prot); | 70 | MEM_RESERVE|MEM_COMMIT|MEM_TOP_DOWN, prot); |
71 | if (!p && !hint) | 71 | if (!p && !hint) |
72 | lj_trace_err(J, LJ_TRERR_MCODEAL); | 72 | lj_trace_err(J, LJ_TRERR_MCODEAL); |
73 | return p; | 73 | return p; |
@@ -82,7 +82,7 @@ static void mcode_free(jit_State *J, void *p, size_t sz) | |||
82 | static int mcode_setprot(void *p, size_t sz, DWORD prot) | 82 | static int mcode_setprot(void *p, size_t sz, DWORD prot) |
83 | { | 83 | { |
84 | DWORD oprot; | 84 | DWORD oprot; |
85 | return !VirtualProtect(p, sz, prot, &oprot); | 85 | return !LJ_WIN_VPROTECT(p, sz, prot, &oprot); |
86 | } | 86 | } |
87 | 87 | ||
88 | #elif LJ_TARGET_POSIX | 88 | #elif LJ_TARGET_POSIX |
@@ -221,8 +221,8 @@ static void *mcode_alloc(jit_State *J, size_t sz) | |||
221 | */ | 221 | */ |
222 | #if LJ_TARGET_MIPS | 222 | #if LJ_TARGET_MIPS |
223 | /* Use the middle of the 256MB-aligned region. */ | 223 | /* Use the middle of the 256MB-aligned region. */ |
224 | uintptr_t target = ((uintptr_t)(void *)lj_vm_exit_handler & 0xf0000000u) + | 224 | uintptr_t target = ((uintptr_t)(void *)lj_vm_exit_handler & |
225 | 0x08000000u; | 225 | ~(uintptr_t)0x0fffffffu) + 0x08000000u; |
226 | #else | 226 | #else |
227 | uintptr_t target = (uintptr_t)(void *)lj_vm_exit_handler & ~(uintptr_t)0xffff; | 227 | uintptr_t target = (uintptr_t)(void *)lj_vm_exit_handler & ~(uintptr_t)0xffff; |
228 | #endif | 228 | #endif |
@@ -255,7 +255,7 @@ static void *mcode_alloc(jit_State *J, size_t sz) | |||
255 | /* All memory addresses are reachable by relative jumps. */ | 255 | /* All memory addresses are reachable by relative jumps. */ |
256 | static void *mcode_alloc(jit_State *J, size_t sz) | 256 | static void *mcode_alloc(jit_State *J, size_t sz) |
257 | { | 257 | { |
258 | #ifdef __OpenBSD__ | 258 | #if defined(__OpenBSD__) || LJ_TARGET_UWP |
259 | /* Allow better executable memory allocation for OpenBSD W^X mode. */ | 259 | /* Allow better executable memory allocation for OpenBSD W^X mode. */ |
260 | void *p = mcode_alloc_at(J, 0, sz, MCPROT_RUN); | 260 | void *p = mcode_alloc_at(J, 0, sz, MCPROT_RUN); |
261 | if (p && mcode_setprot(p, sz, MCPROT_GEN)) { | 261 | if (p && mcode_setprot(p, sz, MCPROT_GEN)) { |