diff options
| author | Peter Maydell <peter.maydell@linaro.org> | 2014-06-11 18:05:21 +0100 |
|---|---|---|
| committer | Peter Maydell <peter.maydell@linaro.org> | 2014-06-11 18:05:21 +0100 |
| commit | 706808585a49bfd266e00b1c7723b6e1b0f4ff35 (patch) | |
| tree | 661e735294e244c1c07fcc88ea76dfdb4fe93e58 /bsd-user/mmap.c | |
| parent | c5cb1afc4675bf5ff66e7a149d2a8cffba2eaa9e (diff) | |
| parent | c4af6d4b13cc263b20133096f4de7b48e0aa7b46 (diff) | |
| download | focaccia-qemu-706808585a49bfd266e00b1c7723b6e1b0f4ff35.tar.gz focaccia-qemu-706808585a49bfd266e00b1c7723b6e1b0f4ff35.zip | |
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-bsd-user-20140611' into staging
bsd-user queue: * build fixes * improvements to strace # gpg: Signature made Wed 11 Jun 2014 15:23:40 BST using RSA key ID 14360CDE # gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>" * remotes/pmaydell/tags/pull-bsd-user-20140611: bsd-user: Fix syscall format, add strace support for more syscalls bsd-user: Implement strace support for thr_* syscalls bsd-user: Implement strace support for extattr_* syscalls bsd-user: Implement strace support for __acl_* syscalls bsd-user: Implement strace support for print_ioctl syscall bsd-user: Implement strace support for print_sysctl syscall bsd-user: GPL v2 attribution update and style bsd-user: add HOST_VARIANT_DIR for various *BSD dependent code exec: replace ffsl with ctzl vhost: replace ffsl with ctzl xen: replace ffsl with ctzl util/qemu-openpty: fix build with musl libc by include termios.h as fallback bsd-user/mmap.c: Don't try to override g_malloc/g_free util/hbitmap.c: Use ctpopl rather than reimplementing a local equivalent bsd-user: refresh freebsd system call numbers Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'bsd-user/mmap.c')
| -rw-r--r-- | bsd-user/mmap.c | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/bsd-user/mmap.c b/bsd-user/mmap.c index aae8ea10be..092bf7f892 100644 --- a/bsd-user/mmap.c +++ b/bsd-user/mmap.c @@ -74,66 +74,6 @@ void mmap_unlock(void) } #endif -static void *bsd_vmalloc(size_t size) -{ - void *p; - mmap_lock(); - /* Use map and mark the pages as used. */ - p = mmap(NULL, size, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_ANON, -1, 0); - - if (h2g_valid(p)) { - /* Allocated region overlaps guest address space. - This may recurse. */ - abi_ulong addr = h2g(p); - page_set_flags(addr & TARGET_PAGE_MASK, TARGET_PAGE_ALIGN(addr + size), - PAGE_RESERVED); - } - - mmap_unlock(); - return p; -} - -void *g_malloc(size_t size) -{ - char * p; - size += 16; - p = bsd_vmalloc(size); - *(size_t *)p = size; - return p + 16; -} - -/* We use map, which is always zero initialized. */ -void * g_malloc0(size_t size) -{ - return g_malloc(size); -} - -void g_free(void *ptr) -{ - /* FIXME: We should unmark the reserved pages here. However this gets - complicated when one target page spans multiple host pages, so we - don't bother. */ - size_t *p; - p = (size_t *)((char *)ptr - 16); - munmap(p, *p); -} - -void *g_realloc(void *ptr, size_t size) -{ - size_t old_size, copy; - void *new_ptr; - - if (!ptr) - return g_malloc(size); - old_size = *(size_t *)((char *)ptr - 16); - copy = old_size < size ? old_size : size; - new_ptr = g_malloc(size); - memcpy(new_ptr, ptr, copy); - g_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) { |