alloc-win32.cpp revision 677833bc953b6cb418c701facbdcf4aa18d6c44e
0N/A * InnoTek Portable Runtime - Memory Allocation, Win32. 0N/A * Copyright (C) 2006 InnoTek Systemberatung GmbH 0N/A * This file is part of VirtualBox Open Source Edition (OSE), as 0N/A * you can redistribute it and/or modify it under the terms of the GNU 0N/A * General Public License as published by the Free Software Foundation, 0N/A * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE 0N/A * distribution. VirtualBox OSE is distributed in the hope that it will 0N/A * be useful, but WITHOUT ANY WARRANTY of any kind. 0N/A * If you received this file as part of a commercial VirtualBox 0N/A * distribution, then only the terms of your commercial VirtualBox 2362N/A * license agreement apply instead of the previous paragraph. 0N/A/******************************************************************************* 0N/A*******************************************************************************/ 0N/A * Allocates memory which may contain code. 0N/A * @returns Pointer to the allocated memory. 0N/A * @returns NULL on failure. 0N/A * @param cb Size in bytes of the memory block to allocate. 0N/A AssertMsg(
cb, (
"Allocating ZERO bytes is really not a good idea! Good luck with the next assertion!\n"));
0N/A * Add PROT_EXEC flag to the page. 0N/A * This is in violation of the SuS where I think it saith that mprotect() shall 0N/A * only be used with mmap()'ed memory. Works on linux and OS/2 LIBC v0.6. 0N/A * @param pv Pointer to memory block. 0N/A * Allocate page aligned memory. 0N/A * @returns Pointer to the allocated memory. 0N/A * @returns NULL if we're out of memory. 0N/A * @param cb Size of the memory block. Will be rounded up to page size. 0N/A * Allocate zero'ed page aligned memory. 0N/A * @returns Pointer to the allocated memory. 0N/A * @returns NULL if we're out of memory. 0N/A * @param cb Size of the memory block. Will be rounded up to page size. 0N/A * Free a memory block allocated with RTMemPageAlloc() or RTMemPageAllocZ(). 5851N/A * @param pv Pointer to the block as it was returned by the allocation function. 0N/A * Change the page level protection of a memory region. 0N/A * @returns iprt status code. 0N/A * @param pv Start of the region. Will be rounded down to nearest page boundary. 0N/A * @param cb Size of the region. Will be rounded up to the nearest page boundary. 0N/A * @param fProtect The new protection, a combination of the RTMEM_PROT_* defines. /* If the compiler had any brains it would warn about this case. */ * Change the page attributes.