Restore fallback allocator

This commit is contained in:
Harrison 2022-05-15 21:45:16 -04:00
parent 91bc6b8ad1
commit 1244b6b4b6

View File

@ -124,10 +124,34 @@ static int mcode_setprot(void *p, size_t sz, int prot)
return mprotect(p, sz, prot); return mprotect(p, sz, prot);
} }
#else #elif LJ_64 || LUAJIT_SECURITY_MCODE
#error "Missing OS support for explicit placement of executable memory" #error "Missing OS support for explicit placement of executable memory"
#else
/* Fallback allocator. This will fail if memory is not executable by default. */
#define MCPROT_RW 0
#define MCPROT_RX 0
#define MCPROT_RWX 0
static void *mcode_alloc_at(jit_State *J, uintptr_t hint, size_t sz, int prot)
{
UNUSED(hint); UNUSED(prot);
return lj_mem_new(J->L, sz);
}
static void mcode_free(jit_State *J, void *p, size_t sz)
{
lj_mem_free(J2G(J), p, sz);
}
static int mcode_setprot(void *p, size_t sz, int prot)
{
UNUSED(p); UNUSED(sz); UNUSED(prot);
return 0;
}
#endif #endif
/* -- MCode area protection ----------------------------------------------- */ /* -- MCode area protection ----------------------------------------------- */