Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-serial
[pandora-kernel.git] / arch / um / sys-x86_64 / unmap.c
1 /*
2  * Copyright (C) 2000 Jeff Dike (jdike@karaya.com)
3  * Licensed under the GPL
4  */
5
6 #include <linux/mman.h>
7 #include <asm/unistd.h>
8 #include <sys/syscall.h>
9
10 int switcheroo(int fd, int prot, void *from, void *to, int size)
11 {
12         if (syscall(__NR_munmap, to, size) < 0){
13                 return(-1);
14         }
15         if (syscall(__NR_mmap, to, size, prot, MAP_SHARED | MAP_FIXED, fd, 0) == (void*) -1){
16                 return(-1);
17         }
18         if (syscall(__NR_munmap, from, size) < 0){
19                 return(-1);
20         }
21         return(0);
22 }