I've got this working. The tricky part was a driver/application can mix malloc forms. If the driver links against this library all the allocations come from the OS service, but if a protocol or EFI boot service return an allocated buffer it will still use the EFI allocation. The gasket code can detect this and do the right thing, as the emulator is passing up the memory map to EFI. You can now use the OS based malloc debugging tools in an EFI driver or appliaction. On OS X this is libgmalloc, also called guard malloc. Signed-off-by: andrewfish. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11886 6f19259b-4bc3-4df7-8a09-765794883524
43 lines
1.4 KiB
INI
43 lines
1.4 KiB
INI
## @file
|
|
# Instance of Memory Allocation Library using EFI Boot Services.
|
|
#
|
|
# Memory Allocation Library that uses EFI Boot Services to allocate
|
|
# and free memory. Calls OS malloc to enable OS based debug tools
|
|
#
|
|
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
|
|
#
|
|
# This program and the accompanying materials
|
|
# are licensed and made available under the terms and conditions of the BSD License
|
|
# which accompanies this distribution. The full text of the license may be found at
|
|
# http://opensource.org/licenses/bsd-license.php.
|
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
#
|
|
#
|
|
##
|
|
|
|
[Defines]
|
|
INF_VERSION = 0x00010005
|
|
BASE_NAME = GuardUefiMemoryAllocationLib
|
|
FILE_GUID = DB290230-3EFA-064F-A317-E146925684FE
|
|
MODULE_TYPE = UEFI_DRIVER
|
|
VERSION_STRING = 1.0
|
|
LIBRARY_CLASS = MemoryAllocationLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER DXE_CORE
|
|
|
|
#
|
|
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
|
#
|
|
|
|
[Sources]
|
|
MemoryAllocationLib.c
|
|
|
|
[Packages]
|
|
MdePkg/MdePkg.dec
|
|
InOsEmuPkg/InOsEmuPkg.dec
|
|
|
|
[LibraryClasses]
|
|
DebugLib
|
|
BaseMemoryLib
|
|
UefiBootServicesTableLib
|
|
EmuThunkLib
|