InOsEmuPkg/Unix/Sec: Add BaseMemoryLib implementation to thunk layer

This implementation only covers a few BaseMemoryLib functions.
The implementation leverates malloc/free in stdlib.

Signed-off-by: jljusten

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11866 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jljusten
2011-06-20 21:58:05 +00:00
parent 7af94c1d0a
commit b8800fc547
6 changed files with 170 additions and 15 deletions

View File

@@ -2,6 +2,7 @@
Emulator Thunk to abstract OS services from pure EFI code
Copyright (c) 2008 - 2011, Apple Inc. All rights reserved.<BR>
Copyright (c) 2011, 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
@@ -15,8 +16,7 @@
#include <PiPei.h>
#include <Library/BaseLib.h>
#include <stdlib.h>
#include <Library/MemoryAllocationLib.h>
UINTN gThunkPpiListSize = 0;
@@ -51,8 +51,12 @@ AddThunkPpi (
)
{
UINTN Index;
gThunkPpiList = realloc (gThunkPpiList, gThunkPpiListSize + sizeof (EFI_PEI_PPI_DESCRIPTOR));
gThunkPpiList = ReallocatePool (
gThunkPpiListSize,
gThunkPpiListSize + sizeof (EFI_PEI_PPI_DESCRIPTOR),
gThunkPpiList
);
if (gThunkPpiList == NULL) {
return EFI_OUT_OF_RESOURCES;
}

View File

@@ -2,6 +2,7 @@
Emulator Thunk to abstract OS services from pure EFI code
Copyright (c) 2008 - 2011, Apple Inc. All rights reserved.<BR>
Copyright (c) 2011, 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
@@ -17,11 +18,10 @@
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Protocol/EmuIoThunk.h>
#include <stdlib.h>
#define EMU_IO_THUNK_PROTOCOL_DATA_SIGNATURE SIGNATURE_32('E','m','u','T')
@@ -53,7 +53,7 @@ AddThunkProtocol (
}
Instance = 0;
StartString = malloc (StrSize (ConfigString));
StartString = AllocatePool (StrSize (ConfigString));
StrCpy (StartString, ConfigString);
while (*StartString != '\0') {
@@ -74,7 +74,7 @@ AddThunkProtocol (
SubString++;
}
Private = malloc (sizeof (EMU_IO_THUNK_PROTOCOL_DATA));
Private = AllocatePool (sizeof (EMU_IO_THUNK_PROTOCOL_DATA));
if (Private == NULL) {
return EFI_OUT_OF_RESOURCES;
}