diff options
author | aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162> | 2009-01-23 15:02:20 +0000 |
---|---|---|
committer | aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162> | 2009-01-23 15:02:20 +0000 |
commit | 1a6f0dbcc0fe79e7bbd35c6e995fec24d32968af (patch) | |
tree | 28e069d5398e117a1c6b0dde96acae6313cb747a | |
parent | 832e9079319c17d528c5b33e285efba9b6e742b4 (diff) | |
download | qemu-1a6f0dbcc0fe79e7bbd35c6e995fec24d32968af.tar.gz qemu-1a6f0dbcc0fe79e7bbd35c6e995fec24d32968af.tar.bz2 qemu-1a6f0dbcc0fe79e7bbd35c6e995fec24d32968af.zip |
linux-user: add qemu_realloc() implementation to unbreak the build (Gerd Hoffman)
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6412 c046a42c-6fe2-441c-8c8c-71466251a162
-rw-r--r-- | linux-user/mmap.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 8e81cdec74..d0fc3e3d1a 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -123,6 +123,19 @@ void qemu_free(void *ptr) munmap(p, *p); } +void *qemu_realloc(void *ptr, size_t size) +{ + size_t old_size, copy; + void *new_ptr; + + old_size = *(size_t *)((char *)ptr - 16); + copy = old_size < size ? old_size : size; + new_ptr = qemu_malloc(size); + memcpy(new_ptr, ptr, copy); + qemu_free(ptr); + return new_ptr; +} + /* NOTE: all the constants are the HOST ones, but addresses are target. */ int target_mprotect(abi_ulong start, abi_ulong len, int prot) { |