fix indention with spaces in powerpc asm
[oweals/musl.git] / src / mman / mprotect.c
index 11d5e23110156e60c71a217a484fdee44d8a3c21..5ab2d8b0278896ace8109eed8251a3e72abe8c47 100644 (file)
@@ -1,7 +1,11 @@
 #include <sys/mman.h>
+#include <limits.h>
 #include "syscall.h"
 
 int mprotect(void *addr, size_t len, int prot)
 {
-       return syscall3(__NR_mprotect, (long)addr, len, prot);
+       size_t start, end;
+       start = (size_t)addr & -PAGE_SIZE;
+       end = (size_t)((char *)addr + len + PAGE_SIZE-1) & -PAGE_SIZE;
+       return syscall(SYS_mprotect, start, end-start, prot);
 }