summaryrefslogtreecommitdiff
path: root/UnixPkg/Sec
diff options
context:
space:
mode:
Diffstat (limited to 'UnixPkg/Sec')
-rw-r--r--UnixPkg/Sec/SecMain.c90
-rw-r--r--UnixPkg/Sec/SecMain.h34
-rw-r--r--UnixPkg/Sec/SecMain.inf4
-rw-r--r--UnixPkg/Sec/UgaX11.c1
-rw-r--r--UnixPkg/Sec/UnixThunk.c5
5 files changed, 13 insertions, 121 deletions
diff --git a/UnixPkg/Sec/SecMain.c b/UnixPkg/Sec/SecMain.c
index 599859e58e..b49f37bfcf 100644
--- a/UnixPkg/Sec/SecMain.c
+++ b/UnixPkg/Sec/SecMain.c
@@ -41,19 +41,6 @@ Abstract:
//
// Globals
//
-EFI_PEI_PE_COFF_LOADER_PROTOCOL_INSTANCE mPeiEfiPeiPeCoffLoaderInstance = {
- {
- SecNt32PeCoffGetImageInfo,
- SecNt32PeCoffLoadImage,
- SecNt32PeCoffRelocateImage,
- SecNt32PeCoffUnloadimage
- },
- NULL
-};
-
-
-
-EFI_PEI_PE_COFF_LOADER_PROTOCOL *gPeiEfiPeiPeCoffLoader = &mPeiEfiPeiPeCoffLoaderInstance.PeCoff;
UNIX_PEI_LOAD_FILE_PPI mSecNtLoadFilePpi = { SecWinNtPeiLoadFile };
@@ -70,11 +57,6 @@ TEMPORARY_RAM_SUPPORT_PPI mSecTemporaryRamSupportPpi = {SecTempo
EFI_PEI_PPI_DESCRIPTOR gPrivateDispatchTable[] = {
{
EFI_PEI_PPI_DESCRIPTOR_PPI,
- &gEfiPeiPeCoffLoaderGuid,
- NULL
- },
- {
- EFI_PEI_PPI_DESCRIPTOR_PPI,
&gUnixPeiLoadFilePpiGuid,
&mSecNtLoadFilePpi
},
@@ -146,6 +128,11 @@ MapFile (
IN OUT EFI_PHYSICAL_ADDRESS *BaseAddress,
OUT UINT64 *Length
);
+EFI_STATUS
+EFIAPI
+SecNt32PeCoffRelocateImage (
+ IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
+ );
INTN
@@ -601,11 +588,7 @@ Returns:
TopOfStack = (VOID *)((UINTN)TopOfStack - sizeof (EFI_SEC_PEI_HAND_OFF) - CPU_STACK_ALIGNMENT);
TopOfStack = ALIGN_POINTER (TopOfStack, CPU_STACK_ALIGNMENT);
- //
- // Patch value in dispatch table values
- //
- gPrivateDispatchTable[0].Ppi = gPeiEfiPeiPeCoffLoader;
-
+
//
// Bind this information into the SEC hand-off state
//
@@ -754,7 +737,7 @@ Returns:
ImageContext.ImageRead = (PE_COFF_LOADER_READ_FILE) SecImageRead;
- Status = gPeiEfiPeiPeCoffLoader->GetImageInfo (gPeiEfiPeiPeCoffLoader, &ImageContext);
+ Status = PeCoffLoaderGetImageInfo (&ImageContext);
if (EFI_ERROR (Status)) {
return Status;
}
@@ -772,12 +755,12 @@ Returns:
ImageContext.ImageAddress &= ~(ImageContext.SectionAlignment - 1);
- Status = gPeiEfiPeiPeCoffLoader->LoadImage (gPeiEfiPeiPeCoffLoader, &ImageContext);
+ Status = PeCoffLoaderLoadImage (&ImageContext);
if (EFI_ERROR (Status)) {
return Status;
}
- Status = gPeiEfiPeiPeCoffLoader->RelocateImage (gPeiEfiPeiPeCoffLoader, &ImageContext);
+ Status = SecNt32PeCoffRelocateImage(&ImageContext);
if (EFI_ERROR (Status)) {
return Status;
}
@@ -901,59 +884,6 @@ Returns:
-EFI_STATUS
-EFIAPI
-SecNt32PeCoffGetImageInfo (
- IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
- IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- )
-{
- EFI_STATUS Status;
-
- Status = PeCoffLoaderGetImageInfo (ImageContext);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- switch (ImageContext->ImageType) {
-
- case EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION:
- ImageContext->ImageCodeMemoryType = EfiLoaderCode;
- ImageContext->ImageDataMemoryType = EfiLoaderData;
- break;
-
- case EFI_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER:
- ImageContext->ImageCodeMemoryType = EfiBootServicesCode;
- ImageContext->ImageDataMemoryType = EfiBootServicesData;
- break;
-
- case EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER:
- case EFI_IMAGE_SUBSYSTEM_SAL_RUNTIME_DRIVER:
- ImageContext->ImageCodeMemoryType = EfiRuntimeServicesCode;
- ImageContext->ImageDataMemoryType = EfiRuntimeServicesData;
- break;
-
- default:
- ImageContext->ImageError = IMAGE_ERROR_INVALID_SUBSYSTEM;
- return RETURN_UNSUPPORTED;
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-SecNt32PeCoffLoadImage (
- IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
- IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- )
-{
- EFI_STATUS Status;
-
- Status = PeCoffLoaderLoadImage (ImageContext);
- return Status;
-}
-
VOID
SecUnixLoaderBreak (
VOID
@@ -964,7 +894,6 @@ SecUnixLoaderBreak (
EFI_STATUS
EFIAPI
SecNt32PeCoffRelocateImage (
- IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
)
{
@@ -1003,7 +932,6 @@ SecNt32PeCoffRelocateImage (
EFI_STATUS
EFIAPI
SecNt32PeCoffUnloadimage (
- IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
)
{
diff --git a/UnixPkg/Sec/SecMain.h b/UnixPkg/Sec/SecMain.h
index 9714b5a4b9..d80d6b44b4 100644
--- a/UnixPkg/Sec/SecMain.h
+++ b/UnixPkg/Sec/SecMain.h
@@ -22,7 +22,6 @@ Abstract:
#include <Protocol/UnixThunk.h>
#include <Pi/PiFirmwareVolume.h>
-#include <Guid/PeiPeCoffLoader.h>
#include <Ppi/StatusCode.h>
#include <Library/PeCoffLib.h>
@@ -505,34 +504,6 @@ Returns:
EFI_STATUS
EFIAPI
-SecNt32PeCoffGetImageInfo (
- IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
- IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- );
-
-EFI_STATUS
-EFIAPI
-SecNt32PeCoffLoadImage (
- IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
- IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- );
-
-EFI_STATUS
-EFIAPI
-SecNt32PeCoffRelocateImage (
- IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
- IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- );
-
-EFI_STATUS
-EFIAPI
-SecNt32PeCoffUnloadimage (
- IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
- IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- );
-
-EFI_STATUS
-EFIAPI
SecTemporaryRamSupport (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase,
@@ -540,9 +511,4 @@ SecTemporaryRamSupport (
IN UINTN CopySize
);
-typedef struct {
- EFI_PEI_PE_COFF_LOADER_PROTOCOL PeCoff;
- VOID *ModHandle;
-} EFI_PEI_PE_COFF_LOADER_PROTOCOL_INSTANCE;
-
extern EFI_UNIX_THUNK_PROTOCOL *gUnix;
diff --git a/UnixPkg/Sec/SecMain.inf b/UnixPkg/Sec/SecMain.inf
index 7048f68212..b2980b857b 100644
--- a/UnixPkg/Sec/SecMain.inf
+++ b/UnixPkg/Sec/SecMain.inf
@@ -53,10 +53,6 @@
ReportStatusCodeLib
-[Guids]
- gEfiPeiPeCoffLoaderGuid # ALWAYS_PRODUCED
-
-
[Ppis]
gUnixPeiLoadFilePpiGuid # PPI ALWAYS_PRODUCED
gEfiPeiStatusCodePpiGuid # PPI ALWAYS_PRODUCED
diff --git a/UnixPkg/Sec/UgaX11.c b/UnixPkg/Sec/UgaX11.c
index a3c152dac3..a6cac78c51 100644
--- a/UnixPkg/Sec/UgaX11.c
+++ b/UnixPkg/Sec/UgaX11.c
@@ -15,7 +15,6 @@
#include <X11/extensions/XShm.h>
#include <X11/keysym.h>
-#include <Guid/PeiPeCoffLoader.h>
#include <Ppi/StatusCode.h>
#include <Library/PeCoffLib.h>
diff --git a/UnixPkg/Sec/UnixThunk.c b/UnixPkg/Sec/UnixThunk.c
index 905cd80d27..d634de6408 100644
--- a/UnixPkg/Sec/UnixThunk.c
+++ b/UnixPkg/Sec/UnixThunk.c
@@ -191,7 +191,10 @@ EFI_UNIX_THUNK_PROTOCOL mUnixThunkTable = {
cfsetispeed,
cfsetospeed,
tcgetattr,
- tcsetattr
+ tcsetattr,
+ dlopen,
+ dlerror,
+ dlsym
};