summaryrefslogtreecommitdiff
path: root/InOsEmuPkg/Include/Protocol/EmuThunk.h
diff options
context:
space:
mode:
authorandrewfish <andrewfish@6f19259b-4bc3-4df7-8a09-765794883524>2011-06-24 23:59:51 +0000
committerandrewfish <andrewfish@6f19259b-4bc3-4df7-8a09-765794883524>2011-06-24 23:59:51 +0000
commit1d7ac5a617fba582abfddb4ce240b81b2c24742f (patch)
treef00432f48f9827b3ca0342beaddd5a813aa6cd8f /InOsEmuPkg/Include/Protocol/EmuThunk.h
parent0de7effb732dfd9f286e1ecaf9dcb35711ee1d78 (diff)
downloadedk2-platforms-1d7ac5a617fba582abfddb4ce240b81b2c24742f.tar.xz
InOsEmuPkg: Add an OS malloc/valloc/free based implementation of the MemoryAllocationLib. Requires extra Thunk APIs.
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
Diffstat (limited to 'InOsEmuPkg/Include/Protocol/EmuThunk.h')
-rw-r--r--InOsEmuPkg/Include/Protocol/EmuThunk.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/InOsEmuPkg/Include/Protocol/EmuThunk.h b/InOsEmuPkg/Include/Protocol/EmuThunk.h
index 6c1190c141..27921b123c 100644
--- a/InOsEmuPkg/Include/Protocol/EmuThunk.h
+++ b/InOsEmuPkg/Include/Protocol/EmuThunk.h
@@ -83,9 +83,15 @@ VOID *
(EFIAPI *EMU_OS_MALLOC) (
IN UINTN Size
);
+
+typedef
+VOID *
+(EFIAPI *EMU_OS_VMALLOC) (
+ IN UINTN Size
+ );
typedef
-VOID
+BOOLEAN
(EFIAPI *EMU_OS_FREE) (
IN VOID *Ptr
);
@@ -221,6 +227,7 @@ struct _EMU_THUNK_PROTOCOL {
// Map OS malloc/free so we can use OS based guard malloc
//
EMU_OS_MALLOC Malloc;
+ EMU_OS_VMALLOC Valloc;
EMU_OS_FREE Free;