diff options
author | blueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-12-15 17:58:49 +0000 |
---|---|---|
committer | blueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-12-15 17:58:49 +0000 |
commit | 3af72a4d98dca033492102603734cbc63cd2694a (patch) | |
tree | c8e5f8dbf3834bf8b440a2ca85c0d65ec4b2a7e8 /linux-user | |
parent | d445bde7e8651d6c49d1178330c966666d3758eb (diff) |
Fix mremap, based on patch by Kirill A. Shutemov
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6056 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'linux-user')
-rw-r--r-- | linux-user/mmap.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 00a941e33a..ead1112ac5 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -24,6 +24,8 @@ #include <unistd.h> #include <errno.h> #include <sys/mman.h> +#include <linux/mman.h> +#include <linux/unistd.h> #include "qemu.h" #include "qemu-common.h" @@ -546,10 +548,11 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, mmap_lock(); -#if defined(MREMAP_FIXED) if (flags & MREMAP_FIXED) - host_addr = mremap(g2h(old_addr), old_size, new_size, - flags, new_addr); + host_addr = (void *) syscall(__NR_mremap, g2h(old_addr), + old_size, new_size, + flags, + new_addr); else if (flags & MREMAP_MAYMOVE) { abi_ulong mmap_start; @@ -559,11 +562,11 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, errno = ENOMEM; host_addr = MAP_FAILED; } else - host_addr = mremap(g2h(old_addr), old_size, new_size, - flags | MREMAP_FIXED, g2h(mmap_start)); - } else -#endif - { + host_addr = (void *) syscall(__NR_mremap, g2h(old_addr), + old_size, new_size, + flags | MREMAP_FIXED, + g2h(mmap_start)); + } else { host_addr = mremap(g2h(old_addr), old_size, new_size, flags); /* Check if address fits target address space */ if ((unsigned long)host_addr + new_size > (abi_ulong)-1) { |