Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ProxyLoaderPkg: Create initial proof of concept
Signed-off-by: Michael Brown <mbrown@fensystems.co.uk>
- Loading branch information
0 parents
commit de0e3e0
Showing
5 changed files
with
206 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/** @file | ||
UEFI loader protocol proxy | ||
Copyright (C) 2018 Michael Brown <mbrown@fensystems.co.uk>. | ||
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. | ||
**/ | ||
|
||
#include <Library/UefiBootServicesTableLib.h> | ||
#include "ProxyLoader.h" | ||
|
||
/** | ||
Image entry point. | ||
@param ImageHandle The firmware allocated handle for the EFI image. | ||
@param SystemTable A pointer to the EFI System Table. | ||
@retval Status Function execution status. | ||
**/ | ||
EFI_STATUS | ||
EFIAPI | ||
UefiMain ( | ||
IN EFI_HANDLE ImageHandle, | ||
IN EFI_SYSTEM_TABLE *SystemTable | ||
) | ||
{ | ||
PROXY_LOADER_PROTOCOL *ProxyLoader; | ||
EFI_STATUS Status; | ||
|
||
// | ||
// Get ProxyLoader protocol installed on image handle | ||
// | ||
Status = gBS->OpenProtocol ( | ||
ImageHandle, | ||
&gProxyLoaderProtocolGuid, | ||
(VOID **)&ProxyLoader, | ||
ImageHandle, | ||
NULL, | ||
EFI_OPEN_PROTOCOL_GET_PROTOCOL | ||
); | ||
if (EFI_ERROR(Status)) { | ||
return Status; | ||
} | ||
|
||
// | ||
// Transfer control to proxied entry point | ||
// | ||
return ProxyLoader->Entry ( ImageHandle, SystemTable ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/** @file | ||
Proxy loader protocol definition. | ||
**/ | ||
|
||
#ifndef __PROXY_LOADER_PROTOCOL_H__ | ||
#define __PROXY_LOADER_PROTOCOL_H__ | ||
|
||
#define PROXY_LOADER_PROTOCOL_GUID \ | ||
{ \ | ||
0x6766FF22, 0xE98C, 0x47D2, {0x9B, 0x7A, 0xD3, 0x27, 0x73, 0xD9, 0x80, 0xBB} \ | ||
} | ||
|
||
typedef struct _PROXY_LOADER_PROTOCOL PROXY_LOADER_PROTOCOL; | ||
|
||
/** | ||
Image entry point. | ||
@param ImageHandle The firmware allocated handle for the EFI image. | ||
@param SystemTable A pointer to the EFI System Table. | ||
@retval Status Function execution status. | ||
**/ | ||
typedef | ||
EFI_STATUS | ||
(EFIAPI *PROXY_LOADER_ENTRY)( | ||
IN EFI_HANDLE ImageHandle, | ||
IN EFI_SYSTEM_TABLE *SystemTable | ||
); | ||
|
||
struct _PROXY_LOADER_PROTOCOL { | ||
PROXY_LOADER_ENTRY Entry; | ||
}; | ||
|
||
extern EFI_GUID gProxyLoaderProtocolGuid; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
## @file | ||
# UEFI loader protocol proxy | ||
# | ||
# This UEFI application calls an entry point provided by a proxy | ||
# loader protocol installed on the image handle. | ||
# | ||
# Copyright (C) 2018 Michael Brown <mbrown@fensystems.co.uk>. | ||
# | ||
# 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 = ProxyLoader | ||
FILE_GUID = 65B0742A-E017-4A30-8BAC-030DAAB0170F | ||
MODULE_TYPE = UEFI_APPLICATION | ||
VERSION_STRING = 1.0 | ||
ENTRY_POINT = UefiMain | ||
|
||
[Sources] | ||
ProxyLoader.c | ||
|
||
[Packages] | ||
MdePkg/MdePkg.dec | ||
ProxyLoaderPkg/ProxyLoaderPkg.dec | ||
|
||
[LibraryClasses] | ||
UefiApplicationEntryPoint | ||
BaseLib | ||
UefiLib | ||
|
||
[Protocols] | ||
gProxyLoaderProtocolGuid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
## @file | ||
# UEFI loader protocol proxy | ||
# | ||
# This UEFI application calls an entry point provided by a proxy | ||
# loader protocol installed on the image handle. | ||
# | ||
# Copyright (C) 2018 Michael Brown <mbrown@fensystems.co.uk>. | ||
# | ||
# 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] | ||
DEC_SPECIFICATION = 0x00010005 | ||
PACKAGE_NAME = ProxyLoaderPkg | ||
PACKAGE_GUID = DBF844DF-CD7C-444E-85A4-653365293A66 | ||
PACKAGE_VERSION = 1.0 | ||
|
||
[Protocols] | ||
gProxyLoaderProtocolGuid = {0x6766FF22, 0xE98C, 0x47D2, {0x9B, 0x7A, 0xD3, 0x27, 0x73, 0xD9, 0x80, 0xBB}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
## @file | ||
# UEFI loader protocol proxy | ||
# | ||
# This DSC file is used for Package Level build. | ||
# | ||
# Copyright (C) 2018 Michael Brown <mbrown@fensystems.co.uk>. | ||
# | ||
# 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] | ||
PLATFORM_NAME = ProxyLoader | ||
PLATFORM_GUID = 2387386F-92F8-41A1-A5B3-1B4024465FD4 | ||
PLATFORM_VERSION = 1.0 | ||
DSC_SPECIFICATION = 0x00010005 | ||
OUTPUT_DIRECTORY = Build/ProxyLoader | ||
SUPPORTED_ARCHITECTURES = IA32|X64|EBC|ARM|AARCH64 | ||
BUILD_TARGETS = DEBUG|RELEASE|NOOPT | ||
SKUID_IDENTIFIER = DEFAULT | ||
|
||
[LibraryClasses] | ||
UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf | ||
BaseLib|MdePkg/Library/BaseLib/BaseLib.inf | ||
BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf | ||
UefiLib|MdePkg/Library/UefiLib/UefiLib.inf | ||
PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf | ||
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf | ||
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf | ||
UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf | ||
UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf | ||
DebugLib|MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf | ||
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf | ||
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf | ||
|
||
[Components] | ||
ProxyLoaderPkg/Application/ProxyLoader/ProxyLoader.inf |