allocex-r3-posix.cpp revision 83de81b6f22c80532a478e79afaee21a0887302a
ea7d33962ceb90ea90e67e427d60b5788f34268avboxsync * IPRT - Memory Allocation, Extended Alloc Workers, posix.
8c48cf39dfb84c1f26e0e7fbd1c407e25a34eef1vboxsync * Copyright (C) 2006-2013 Oracle Corporation
65b0f0cd3c38007138720b7eaa43c963a9ee1244vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
65b0f0cd3c38007138720b7eaa43c963a9ee1244vboxsync * available from http://www.virtualbox.org. This file is free software;
65b0f0cd3c38007138720b7eaa43c963a9ee1244vboxsync * you can redistribute it and/or modify it under the terms of the GNU
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * General Public License (GPL) as published by the Free Software
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * The contents of this file may alternatively be used under the terms
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * of the Common Development and Distribution License Version 1.0
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * VirtualBox OSE distribution, in which case the provisions of the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * CDDL are applicable instead of those of the GPL.
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * You may elect to license modified versions of this file under the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * terms and conditions of either the GPL or the CDDL or both.
cf57145d4697dceca3f0542b370c20f7a2c5c6e8vboxsync/*******************************************************************************
65b0f0cd3c38007138720b7eaa43c963a9ee1244vboxsync* Header Files *
cf57145d4697dceca3f0542b370c20f7a2c5c6e8vboxsync*******************************************************************************/
c0cb47bd8aa02fca08ff72a37ba5c65894241cbfvboxsyncDECLHIDDEN(int) rtMemAllocEx16BitReach(size_t cbAlloc, uint32_t fFlags, void **ppv)
e52b0dfe3d9ead70e24f2ce4ed3faa6c79c00618vboxsync * Try with every possible address hint since the possible range is very limited.
e52b0dfe3d9ead70e24f2ce4ed3faa6c79c00618vboxsync int fProt = PROT_READ | PROT_WRITE | (fFlags & RTMEMALLOCEX_FLAGS_EXEC ? PROT_EXEC : 0);
c0cb47bd8aa02fca08ff72a37ba5c65894241cbfvboxsync void *pv = mmap((void *)uAddr, cbAlloc, fProt, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
f2af1be3e27a2fefe95332260d360f4b26cffbcfvboxsyncDECLHIDDEN(int) rtMemAllocEx32BitReach(size_t cbAlloc, uint32_t fFlags, void **ppv)
f2af1be3e27a2fefe95332260d360f4b26cffbcfvboxsync int fProt = PROT_READ | PROT_WRITE | (fFlags & RTMEMALLOCEX_FLAGS_EXEC ? PROT_EXEC : 0);
75d8fea43f2d7474d00172dcf906f7ab598a8c8fvboxsync void *pv = mmap(NULL, cbAlloc, fProt, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
eaae6c3ce81916ccc4e74af4b55972ba956cf5c8vboxsync void *pv = mmap(NULL, cbAlloc, fProt, MAP_PRIVATE | MAP_ANONYMOUS | MAP_32BIT, -1, 0);
b6dc9545438e63d05fff621e85ddb7dc39cf14e7vboxsync /** @todo On linux, we need an accurate hint. Since I don't need this branch of
c0cb47bd8aa02fca08ff72a37ba5c65894241cbfvboxsync * the code right now, I won't bother starting to parse
20593760b116c90f3e439552763eef632a3bbb17vboxsync * /proc/curproc/mmap right now... */