mirror of
https://github.com/RaySollium99/libpicofe.git
synced 2025-09-05 06:47:45 -04:00
add plat_mem_set_exec()
This commit is contained in:
parent
c2981fc0ee
commit
6282e17ef5
2 changed files with 11 additions and 0 deletions
10
linux/plat.c
10
linux/plat.c
|
@ -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 */
|
/* lprintf */
|
||||||
void lprintf(const char *fmt, ...)
|
void lprintf(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
|
|
1
plat.h
1
plat.h
|
@ -102,6 +102,7 @@ void plat_sleep_ms(int ms);
|
||||||
void *plat_mmap(unsigned long addr, size_t size, int need_exec, int is_fixed);
|
void *plat_mmap(unsigned long addr, size_t size, int need_exec, int is_fixed);
|
||||||
void *plat_mremap(void *ptr, size_t oldsize, size_t newsize);
|
void *plat_mremap(void *ptr, size_t oldsize, size_t newsize);
|
||||||
void plat_munmap(void *ptr, size_t size);
|
void plat_munmap(void *ptr, size_t size);
|
||||||
|
int plat_mem_set_exec(void *ptr, size_t size);
|
||||||
|
|
||||||
/* timers, to be used for time diff and must refer to the same clock */
|
/* timers, to be used for time diff and must refer to the same clock */
|
||||||
unsigned int plat_get_ticks_ms(void);
|
unsigned int plat_get_ticks_ms(void);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue