diff options
Diffstat (limited to 'arch/um/sys-x86_64/unmap.c')
-rw-r--r-- | arch/um/sys-x86_64/unmap.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/arch/um/sys-x86_64/unmap.c b/arch/um/sys-x86_64/unmap.c index f4a4bffd8a18..57c9286a701b 100644 --- a/arch/um/sys-x86_64/unmap.c +++ b/arch/um/sys-x86_64/unmap.c | |||
@@ -5,20 +5,17 @@ | |||
5 | 5 | ||
6 | #include <linux/mman.h> | 6 | #include <linux/mman.h> |
7 | #include <asm/unistd.h> | 7 | #include <asm/unistd.h> |
8 | #include <sys/syscall.h> | ||
8 | 9 | ||
9 | static int errno; | ||
10 | |||
11 | static inline _syscall2(int,munmap,void *,start,size_t,len) | ||
12 | static inline _syscall6(void *,mmap,void *,addr,size_t,len,int,prot,int,flags,int,fd,off_t,offset) | ||
13 | int switcheroo(int fd, int prot, void *from, void *to, int size) | 10 | int switcheroo(int fd, int prot, void *from, void *to, int size) |
14 | { | 11 | { |
15 | if(munmap(to, size) < 0){ | 12 | if (syscall(__NR_munmap, to, size) < 0){ |
16 | return(-1); | 13 | return(-1); |
17 | } | 14 | } |
18 | if(mmap(to, size, prot, MAP_SHARED | MAP_FIXED, fd, 0) == (void*) -1){ | 15 | if (syscall(__NR_mmap, to, size, prot, MAP_SHARED | MAP_FIXED, fd, 0) == (void*) -1){ |
19 | return(-1); | 16 | return(-1); |
20 | } | 17 | } |
21 | if(munmap(from, size) < 0){ | 18 | if (syscall(__NR_munmap, from, size) < 0){ |
22 | return(-1); | 19 | return(-1); |
23 | } | 20 | } |
24 | return(0); | 21 | return(0); |