1570af302Sopenharmony_ci#include <sys/mman.h> 2570af302Sopenharmony_ci#include "libc.h" 3570af302Sopenharmony_ci#include "syscall.h" 4570af302Sopenharmony_ci 5570af302Sopenharmony_ciint __mprotect(void *addr, size_t len, int prot) 6570af302Sopenharmony_ci{ 7570af302Sopenharmony_ci size_t start, end; 8570af302Sopenharmony_ci start = (size_t)addr & -PAGE_SIZE; 9570af302Sopenharmony_ci end = (size_t)((char *)addr + len + PAGE_SIZE-1) & -PAGE_SIZE; 10570af302Sopenharmony_ci return syscall(SYS_mprotect, start, end-start, prot); 11570af302Sopenharmony_ci} 12570af302Sopenharmony_ci 13570af302Sopenharmony_ciweak_alias(__mprotect, mprotect); 14