add plat_mem_set_exec()

This commit is contained in:
Grazvydas Ignotas 2013-06-28 01:41:09 +03:00
parent c2981fc0ee
commit 6282e17ef5
2 changed files with 11 additions and 0 deletions

View file

@ -200,6 +200,16 @@ void plat_munmap(void *ptr, size_t size)
}
}
int plat_mem_set_exec(void *ptr, size_t size)
{
int ret = mprotect(ptr, size, PROT_READ | PROT_WRITE | PROT_EXEC);
if (ret != 0)
fprintf(stderr, "mprotect(%p, %zd) failed: %d\n",
ptr, size, errno);
return ret;
}
/* lprintf */
void lprintf(const char *fmt, ...)
{