summaryrefslogtreecommitdiff
path: root/UnixPkg/Library
diff options
context:
space:
mode:
Diffstat (limited to 'UnixPkg/Library')
-rw-r--r--UnixPkg/Library/DxeUnixPeCoffExtraActionLib/DxeUnixPeCoffExtraActionLib.c39
-rw-r--r--UnixPkg/Library/DxeUnixPeCoffExtraActionLib/DxeUnixPeCoffExtraActionLib.inf4
-rw-r--r--UnixPkg/Library/EdkUnixPeiPeCoffGetEntryPointLib/PeCoffGetEntryPoint.c39
-rw-r--r--UnixPkg/Library/PeiUnixPeCoffExtraActionLib/PeiUnixPeCoffExtraActionLib.c36
-rw-r--r--UnixPkg/Library/PeiUnixPeCoffExtraActionLib/PeiUnixPeCoffExtraActionLib.inf4
-rw-r--r--UnixPkg/Library/UnixBdsLib/PlatformBds.inf2
-rw-r--r--UnixPkg/Library/UnixBdsLib/PlatformData.c40
7 files changed, 52 insertions, 112 deletions
diff --git a/UnixPkg/Library/DxeUnixPeCoffExtraActionLib/DxeUnixPeCoffExtraActionLib.c b/UnixPkg/Library/DxeUnixPeCoffExtraActionLib/DxeUnixPeCoffExtraActionLib.c
index 014390cf4f..b700975fc8 100644
--- a/UnixPkg/Library/DxeUnixPeCoffExtraActionLib/DxeUnixPeCoffExtraActionLib.c
+++ b/UnixPkg/Library/DxeUnixPeCoffExtraActionLib/DxeUnixPeCoffExtraActionLib.c
@@ -1,6 +1,7 @@
/**@file
Copyright (c) 2006 - 2009, Intel Corporation
+Portions copyright (c) 2008-2009 Apple Inc. All rights reserved.
All rights reserved. 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
@@ -22,12 +23,10 @@ Abstract:
**/
-#include <FrameworkDxe.h>
-#include <Guid/StatusCodeDataTypeId.h>
+#include <PiDxe.h>
#include <UnixDxe.h>
#include <Library/PeCoffLib.h>
-
#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
#include <Library/HobLib.h>
@@ -35,9 +34,12 @@ Abstract:
#include <Library/PeCoffExtraActionLib.h>
//
+
// Cache of UnixThunk protocol
+
//
-EFI_UNIX_THUNK_PROTOCOL *mUnix;
+
+EFI_UNIX_THUNK_PROTOCOL *mUnix = NULL;
/**
@@ -82,35 +84,10 @@ PeCoffLoaderRelocateImageExtraAction (
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
)
{
- VOID * Handle;
- VOID * Entry;
-
- ASSERT (ImageContext != NULL);
-
- Handle = NULL;
- Entry = NULL;
-
- DEBUG ((EFI_D_ERROR, "Loading %a 0x%08lx - entry point 0x%08lx\n",
- ImageContext->PdbPointer,
- (UINTN)ImageContext->ImageAddress,
- (UINTN)ImageContext->EntryPoint));
-
- Handle = mUnix->Dlopen(ImageContext->PdbPointer, RTLD_NOW);
-
- if (Handle) {
- Entry = mUnix->Dlsym(Handle, "_ModuleEntryPoint");
- } else {
- DEBUG ((EFI_D_ERROR, "%a\n", mUnix->Dlerror()));
- }
-
- if (Entry != NULL) {
- ImageContext->EntryPoint = Entry;
- DEBUG ((EFI_D_ERROR, "Change %a Entrypoint to :0x%08lx\n", ImageContext->PdbPointer, Entry));
+ mUnix->PeCoffRelocateImageExtraAction (ImageContext);
}
- return;
- }
/**
Performs additional actions just before a PE/COFF image is unloaded. Any resources
@@ -128,5 +105,5 @@ PeCoffLoaderUnloadImageExtraAction (
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
)
{
- ASSERT (ImageContext != NULL);
+ mUnix->PeCoffUnloadImageExtraAction (ImageContext);
}
diff --git a/UnixPkg/Library/DxeUnixPeCoffExtraActionLib/DxeUnixPeCoffExtraActionLib.inf b/UnixPkg/Library/DxeUnixPeCoffExtraActionLib/DxeUnixPeCoffExtraActionLib.inf
index 93c514692c..83d6963982 100644
--- a/UnixPkg/Library/DxeUnixPeCoffExtraActionLib/DxeUnixPeCoffExtraActionLib.inf
+++ b/UnixPkg/Library/DxeUnixPeCoffExtraActionLib/DxeUnixPeCoffExtraActionLib.inf
@@ -2,7 +2,7 @@
# PeCoff extra action libary for DXE phase that run Unix emulator.
#
# Lib to provide memory journal status code reporting Routines
-# Copyright (c) 2007, Intel Corporation
+# Copyright (c) 2007 - 2009, Intel Corporation
# All rights reserved. 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
@@ -39,8 +39,6 @@
[Packages]
UnixPkg/UnixPkg.dec
MdePkg/MdePkg.dec
- IntelFrameworkPkg/IntelFrameworkPkg.dec
- IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
[LibraryClasses]
DebugLib
diff --git a/UnixPkg/Library/EdkUnixPeiPeCoffGetEntryPointLib/PeCoffGetEntryPoint.c b/UnixPkg/Library/EdkUnixPeiPeCoffGetEntryPointLib/PeCoffGetEntryPoint.c
index be9cba831c..ef0d6c17cb 100644
--- a/UnixPkg/Library/EdkUnixPeiPeCoffGetEntryPointLib/PeCoffGetEntryPoint.c
+++ b/UnixPkg/Library/EdkUnixPeiPeCoffGetEntryPointLib/PeCoffGetEntryPoint.c
@@ -1,6 +1,7 @@
/*++
-Copyright (c) 2006 - 2008, Intel Corporation
+Copyright (c) 2006 - 2009, Intel Corporation
+Portions copyright (c) 2008-2009 Apple Inc. All rights reserved.
All rights reserved. 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
@@ -54,38 +55,24 @@ Returns:
--*/
{
+ PEI_UNIX_THUNK_PPI *UnixThunkPpi;
EFI_STATUS Status;
- EFI_PEI_PPI_DESCRIPTOR *PpiDescriptor;
- UNIX_PEI_LOAD_FILE_PPI *PeiUnixService;
- EFI_PHYSICAL_ADDRESS ImageAddress;
- UINT64 ImageSize;
- EFI_PHYSICAL_ADDRESS ImageEntryPoint;
-
- ASSERT (Pe32Data != NULL);
- ASSERT (EntryPoint != NULL);
+ EFI_UNIX_THUNK_PROTOCOL *Unix;
+ //
+ // Locate Unix ThunkPpi for retrieving standard output handle
+ //
Status = PeiServicesLocatePpi (
- &gUnixPeiLoadFilePpiGuid,
+ &gPeiUnixThunkPpiGuid,
0,
- &PpiDescriptor,
- (void **)&PeiUnixService
+ NULL,
+ (VOID **) &UnixThunkPpi
);
-
ASSERT_EFI_ERROR (Status);
- Status = PeiUnixService->PeiLoadFileService (
- Pe32Data,
- &ImageAddress,
- &ImageSize,
- &ImageEntryPoint
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
+ Unix = (EFI_UNIX_THUNK_PROTOCOL *)UnixThunkPpi->UnixThunk ();
- *EntryPoint = (VOID*)(UINTN)ImageEntryPoint;
- return Status;
+ return Unix->PeCoffGetEntryPoint (Pe32Data, EntryPoint);
}
/**
@@ -255,6 +242,8 @@ PeCoffLoaderGetPdbPointer (
return (VOID *) ((CHAR8 *)CodeViewEntryPointer + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY));
case CODEVIEW_SIGNATURE_RSDS:
return (VOID *) ((CHAR8 *)CodeViewEntryPointer + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_RSDS_ENTRY));
+ case CODEVIEW_SIGNATURE_MTOC:
+ return (VOID *) ((CHAR8 *)CodeViewEntryPointer + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_MTOC_ENTRY));
default:
break;
}
diff --git a/UnixPkg/Library/PeiUnixPeCoffExtraActionLib/PeiUnixPeCoffExtraActionLib.c b/UnixPkg/Library/PeiUnixPeCoffExtraActionLib/PeiUnixPeCoffExtraActionLib.c
index 3b2af0301b..dea03fb142 100644
--- a/UnixPkg/Library/PeiUnixPeCoffExtraActionLib/PeiUnixPeCoffExtraActionLib.c
+++ b/UnixPkg/Library/PeiUnixPeCoffExtraActionLib/PeiUnixPeCoffExtraActionLib.c
@@ -1,6 +1,7 @@
/**@file
Copyright (c) 2006 - 2009, Intel Corporation
+Portions copyright (c) 2008-2009 Apple Inc. All rights reserved.
All rights reserved. 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
@@ -36,7 +37,7 @@ Abstract:
EFI_UNIX_THUNK_PROTOCOL *mUnix = NULL;
/**
- The function caches the pointer of the WinNT thunk functions
+ The function caches the pointer of the Unix thunk functions
It will ASSERT() if Unix thunk ppi is not installed.
@retval EFI_SUCCESS WinNT thunk protocol is found and cached.
@@ -83,38 +84,12 @@ PeCoffLoaderRelocateImageExtraAction (
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
)
{
- VOID * Handle;
- VOID * Entry;
-
- ASSERT (ImageContext != NULL);
-
- Handle = NULL;
- Entry = NULL;
-
if (mUnix == NULL) {
UnixPeCoffGetUnixThunkStucture ();
}
- DEBUG ((EFI_D_ERROR, "Loading %a 0x%08lx - entry point 0x%08lx\n",
- ImageContext->PdbPointer,
- (UINTN)ImageContext->ImageAddress,
- (UINTN)ImageContext->EntryPoint));
-
- Handle = mUnix->Dlopen (ImageContext->PdbPointer, RTLD_NOW);
-
- if (Handle) {
- Entry = mUnix->Dlsym(Handle, "_ModuleEntryPoint");
- } else {
- DEBUG ((EFI_D_ERROR, "%a\n", mUnix->Dlerror()));
+ mUnix->PeCoffRelocateImageExtraAction (ImageContext);
}
-
- if (Entry != NULL) {
- ImageContext->EntryPoint = Entry;
- DEBUG ((EFI_D_ERROR, "Change %a Entrypoint to :0x%08lx\n", ImageContext->PdbPointer, Entry));
- }
-
- return;
- }
/**
Performs additional actions just before a PE/COFF image is unloaded. Any resources
@@ -132,5 +107,8 @@ PeCoffLoaderUnloadImageExtraAction (
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
)
{
- ASSERT (ImageContext != NULL);
+ if (mUnix == NULL) {
+ UnixPeCoffGetUnixThunkStucture ();
+ }
+ mUnix->PeCoffUnloadImageExtraAction (ImageContext);
}
diff --git a/UnixPkg/Library/PeiUnixPeCoffExtraActionLib/PeiUnixPeCoffExtraActionLib.inf b/UnixPkg/Library/PeiUnixPeCoffExtraActionLib/PeiUnixPeCoffExtraActionLib.inf
index 1ecdd29681..722d586e17 100644
--- a/UnixPkg/Library/PeiUnixPeCoffExtraActionLib/PeiUnixPeCoffExtraActionLib.inf
+++ b/UnixPkg/Library/PeiUnixPeCoffExtraActionLib/PeiUnixPeCoffExtraActionLib.inf
@@ -2,7 +2,7 @@
# PeCoff extra action libary for Pei phase that run UNIX emulator.
#
# Lib to provide memory journal status code reporting Routines
-# Copyright (c) 2007, Intel Corporation
+# Copyright (c) 2007 - 2009, Intel Corporation
# All rights reserved. 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
@@ -37,8 +37,6 @@
[Packages]
MdePkg/MdePkg.dec
UnixPkg/UnixPkg.dec
- IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
- IntelFrameworkPkg/IntelFrameworkPkg.dec
[LibraryClasses]
BaseLib
diff --git a/UnixPkg/Library/UnixBdsLib/PlatformBds.inf b/UnixPkg/Library/UnixBdsLib/PlatformBds.inf
index 1a5604d8f2..834b5c6897 100644
--- a/UnixPkg/Library/UnixBdsLib/PlatformBds.inf
+++ b/UnixPkg/Library/UnixBdsLib/PlatformBds.inf
@@ -50,7 +50,7 @@
BaseMemoryLib
DebugLib
PcdLib
- GenericBdsLib
+ GenericBdsLib
DevicePathLib
diff --git a/UnixPkg/Library/UnixBdsLib/PlatformData.c b/UnixPkg/Library/UnixBdsLib/PlatformData.c
index 9051dbf33f..df60c1c96c 100644
--- a/UnixPkg/Library/UnixBdsLib/PlatformData.c
+++ b/UnixPkg/Library/UnixBdsLib/PlatformData.c
@@ -1,6 +1,6 @@
/*++
-Copyright (c) 2006, Intel Corporation
+Copyright (c) 2006 - 2009, Intel Corporation
All rights reserved. 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
@@ -32,22 +32,22 @@ UINT16 gPlatformBootTimeOutDefault = 10;
//
UNIX_PLATFORM_UGA_DEVICE_PATH gUgaDevicePath0 =
{
- {
+ {
HARDWARE_DEVICE_PATH,
HW_VENDOR_DP,
- {
+ {
(UINT8) (sizeof (VENDOR_DEVICE_PATH)),
- (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8),
- },
+ (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)
+ },
EFI_UNIX_THUNK_PROTOCOL_GUID
},
{
HARDWARE_DEVICE_PATH,
HW_VENDOR_DP,
- {
+ {
(UINT8) (sizeof (UNIX_VENDOR_DEVICE_PATH_NODE)),
- (UINT8) ((sizeof (UNIX_VENDOR_DEVICE_PATH_NODE)) >> 8),
- },
+ (UINT8) ((sizeof (UNIX_VENDOR_DEVICE_PATH_NODE)) >> 8)
+ },
EFI_UNIX_UGA_GUID,
0
},
@@ -58,19 +58,19 @@ UNIX_PLATFORM_UGA_DEVICE_PATH gUgaDevicePath1 = {
{
HARDWARE_DEVICE_PATH,
HW_VENDOR_DP,
- {
+ {
(UINT8) (sizeof (VENDOR_DEVICE_PATH)),
- (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8),
- },
+ (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)
+ },
EFI_UNIX_THUNK_PROTOCOL_GUID
},
{
HARDWARE_DEVICE_PATH,
HW_VENDOR_DP,
- {
+ {
(UINT8) (sizeof (UNIX_VENDOR_DEVICE_PATH_NODE)),
- (UINT8) ((sizeof (UNIX_VENDOR_DEVICE_PATH_NODE)) >> 8),
- },
+ (UINT8) ((sizeof (UNIX_VENDOR_DEVICE_PATH_NODE)) >> 8)
+ },
EFI_UNIX_UGA_GUID,
1
},
@@ -80,20 +80,20 @@ UNIX_PLATFORM_UGA_DEVICE_PATH gUgaDevicePath1 = {
UNIX_CONSOLE_DEVICE_PATH gUnixConsoleDevicePath = {
{
HARDWARE_DEVICE_PATH,
- HW_VENDOR_DP,
+ HW_VENDOR_DP,
{
(UINT8) (sizeof (VENDOR_DEVICE_PATH)),
- (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8),
- },
+ (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)
+ },
EFI_UNIX_THUNK_PROTOCOL_GUID
},
{
HARDWARE_DEVICE_PATH,
- HW_VENDOR_DP,
+ HW_VENDOR_DP,
{
(UINT8) (sizeof (UNIX_VENDOR_DEVICE_PATH_NODE)),
- (UINT8) ((sizeof (UNIX_VENDOR_DEVICE_PATH_NODE)) >> 8),
- },
+ (UINT8) ((sizeof (UNIX_VENDOR_DEVICE_PATH_NODE)) >> 8)
+ },
EFI_UNIX_CONSOLE_GUID,
0
},