2 * Copyright (C) 2000 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
6 #include <linux/mman.h>
7 #include <asm/unistd.h>
8 #include <sys/syscall.h>
10 int switcheroo(int fd, int prot, void *from, void *to, int size)
12 if (syscall(__NR_munmap, to, size) < 0){
15 if (syscall(__NR_mmap2, to, size, prot, MAP_SHARED | MAP_FIXED, fd, 0) == (void*) -1 ){
18 if (syscall(__NR_munmap, from, size) < 0){