mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-27 23:54:02 +02:00
Ring3: Merged Ring3Dxe and Ring3UefiBootServicesTableLib into DxeRing3.
This commit is contained in:
parent
702adc6292
commit
f36554560b
102
MdeModulePkg/Core/Dxe/DxeRing3/DxeRing3.c
Normal file
102
MdeModulePkg/Core/Dxe/DxeRing3/DxeRing3.c
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
/** @file
|
||||||
|
|
||||||
|
Copyright (c) 2024, Mikhail Krichanov. All rights reserved.
|
||||||
|
SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include <Uefi.h>
|
||||||
|
#include <Library/BaseMemoryLib.h>
|
||||||
|
|
||||||
|
#include "Ring3.h"
|
||||||
|
|
||||||
|
EFI_BOOT_SERVICES mBootServices = {
|
||||||
|
{
|
||||||
|
EFI_BOOT_SERVICES_SIGNATURE, // Signature
|
||||||
|
EFI_BOOT_SERVICES_REVISION, // Revision
|
||||||
|
sizeof (EFI_BOOT_SERVICES), // HeaderSize
|
||||||
|
0, // CRC32
|
||||||
|
0 // Reserved
|
||||||
|
},
|
||||||
|
(EFI_RAISE_TPL)Ring3RaiseTpl, // RaiseTPL
|
||||||
|
(EFI_RESTORE_TPL)Ring3RestoreTpl, // RestoreTPL
|
||||||
|
(EFI_ALLOCATE_PAGES)Ring3AllocatePages, // AllocatePages
|
||||||
|
(EFI_FREE_PAGES)Ring3FreePages, // FreePages
|
||||||
|
(EFI_GET_MEMORY_MAP)Ring3GetMemoryMap, // GetMemoryMap
|
||||||
|
(EFI_ALLOCATE_POOL)Ring3AllocatePool, // AllocatePool
|
||||||
|
(EFI_FREE_POOL)Ring3FreePool, // FreePool
|
||||||
|
(EFI_CREATE_EVENT)Ring3CreateEvent, // CreateEvent
|
||||||
|
(EFI_SET_TIMER)Ring3SetTimer, // SetTimer
|
||||||
|
(EFI_WAIT_FOR_EVENT)Ring3WaitForEvent, // WaitForEvent
|
||||||
|
(EFI_SIGNAL_EVENT)Ring3SignalEvent, // SignalEvent
|
||||||
|
(EFI_CLOSE_EVENT)Ring3CloseEvent, // CloseEvent
|
||||||
|
(EFI_CHECK_EVENT)Ring3CheckEvent, // CheckEvent
|
||||||
|
(EFI_INSTALL_PROTOCOL_INTERFACE)Ring3InstallProtocolInterface, // InstallProtocolInterface
|
||||||
|
(EFI_REINSTALL_PROTOCOL_INTERFACE)Ring3ReinstallProtocolInterface, // ReinstallProtocolInterface
|
||||||
|
(EFI_UNINSTALL_PROTOCOL_INTERFACE)Ring3UninstallProtocolInterface, // UninstallProtocolInterface
|
||||||
|
(EFI_HANDLE_PROTOCOL)Ring3HandleProtocol, // HandleProtocol
|
||||||
|
(VOID *)NULL, // Reserved
|
||||||
|
(EFI_REGISTER_PROTOCOL_NOTIFY)Ring3RegisterProtocolNotify, // RegisterProtocolNotify
|
||||||
|
(EFI_LOCATE_HANDLE)Ring3LocateHandle, // LocateHandle
|
||||||
|
(EFI_LOCATE_DEVICE_PATH)Ring3LocateDevicePath, // LocateDevicePath
|
||||||
|
(EFI_INSTALL_CONFIGURATION_TABLE)Ring3InstallConfigurationTable, // InstallConfigurationTable
|
||||||
|
(EFI_IMAGE_LOAD)Ring3LoadImage, // LoadImage
|
||||||
|
(EFI_IMAGE_START)Ring3StartImage, // StartImage
|
||||||
|
(EFI_EXIT)Ring3Exit, // Exit
|
||||||
|
(EFI_IMAGE_UNLOAD)Ring3UnloadImage, // UnloadImage
|
||||||
|
(EFI_EXIT_BOOT_SERVICES)Ring3ExitBootServices, // ExitBootServices
|
||||||
|
(EFI_GET_NEXT_MONOTONIC_COUNT)Ring3GetNextMonotonicCount, // GetNextMonotonicCount
|
||||||
|
(EFI_STALL)Ring3Stall, // Stall
|
||||||
|
(EFI_SET_WATCHDOG_TIMER)Ring3SetWatchdogTimer, // SetWatchdogTimer
|
||||||
|
(EFI_CONNECT_CONTROLLER)Ring3ConnectController, // ConnectController
|
||||||
|
(EFI_DISCONNECT_CONTROLLER)Ring3DisconnectController, // DisconnectController
|
||||||
|
(EFI_OPEN_PROTOCOL)Ring3OpenProtocol, // OpenProtocol
|
||||||
|
(EFI_CLOSE_PROTOCOL)Ring3CloseProtocol, // CloseProtocol
|
||||||
|
(EFI_OPEN_PROTOCOL_INFORMATION)Ring3OpenProtocolInformation, // OpenProtocolInformation
|
||||||
|
(EFI_PROTOCOLS_PER_HANDLE)Ring3ProtocolsPerHandle, // ProtocolsPerHandle
|
||||||
|
(EFI_LOCATE_HANDLE_BUFFER)Ring3LocateHandleBuffer, // LocateHandleBuffer
|
||||||
|
(EFI_LOCATE_PROTOCOL)Ring3LocateProtocol, // LocateProtocol
|
||||||
|
(EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES)Ring3InstallMultipleProtocolInterfaces, // InstallMultipleProtocolInterfaces
|
||||||
|
(EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES)Ring3UninstallMultipleProtocolInterfaces, // UninstallMultipleProtocolInterfaces
|
||||||
|
(EFI_CALCULATE_CRC32)Ring3CalculateCrc32, // CalculateCrc32
|
||||||
|
(EFI_COPY_MEM)CopyMem, // CopyMem
|
||||||
|
(EFI_SET_MEM)SetMem, // SetMem
|
||||||
|
(EFI_CREATE_EVENT_EX)Ring3CreateEventEx, // CreateEventEx
|
||||||
|
};
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
Ring3Call (
|
||||||
|
IN VOID *Dummy,
|
||||||
|
IN VOID *EntryPoint,
|
||||||
|
IN EFI_HANDLE ImageHandle,
|
||||||
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_IMAGE_ENTRY_POINT Function;
|
||||||
|
|
||||||
|
Function = (EFI_IMAGE_ENTRY_POINT)EntryPoint;
|
||||||
|
|
||||||
|
Function (ImageHandle, SystemTable);
|
||||||
|
|
||||||
|
SysCall (SysCallReturnToCore);
|
||||||
|
|
||||||
|
return EFI_UNSUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
Ring3EntryPoint (
|
||||||
|
IN EFI_HANDLE ImageHandle,
|
||||||
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
|
)
|
||||||
|
{
|
||||||
|
RING3_DATA *Ring3Data;
|
||||||
|
|
||||||
|
Ring3Data = (RING3_DATA *)SystemTable;
|
||||||
|
|
||||||
|
Ring3Data->EntryPoint = (VOID *)Ring3Call;
|
||||||
|
Ring3Data->BootServices = &mBootServices;
|
||||||
|
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
[Defines]
|
[Defines]
|
||||||
INF_VERSION = 0x00010005
|
INF_VERSION = 0x00010005
|
||||||
BASE_NAME = Ring3Dxe
|
BASE_NAME = DxeRing3
|
||||||
FILE_GUID = 88EA50C2-0DEA-4F13-B691-B506554E632B
|
FILE_GUID = 88EA50C2-0DEA-4F13-B691-B506554E632B
|
||||||
MODULE_TYPE = DXE_DRIVER
|
MODULE_TYPE = DXE_DRIVER
|
||||||
VERSION_STRING = 1.0
|
VERSION_STRING = 1.0
|
||||||
@ -22,15 +22,25 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
[Sources]
|
[Sources]
|
||||||
Ring3Dxe.c
|
Ring3.h
|
||||||
|
DxeRing3.c
|
||||||
|
Ring3UefiBootServices.c
|
||||||
|
|
||||||
|
[Sources.X64]
|
||||||
|
X64/SysCall.nasm
|
||||||
|
|
||||||
[Packages]
|
[Packages]
|
||||||
MdePkg/MdePkg.dec
|
MdePkg/MdePkg.dec
|
||||||
|
|
||||||
[LibraryClasses]
|
[LibraryClasses]
|
||||||
BaseLib
|
BaseLib
|
||||||
UefiBootServicesTableLib
|
BaseMemoryLib
|
||||||
|
DebugLib
|
||||||
UefiDriverEntryPoint
|
UefiDriverEntryPoint
|
||||||
|
|
||||||
|
[Protocols]
|
||||||
|
gEfiDevicePathUtilitiesProtocolGuid ## SOMETIMES_CONSUMES
|
||||||
|
gEfiLoadedImageProtocolGuid ## SOMETIMES_CONSUMES
|
||||||
|
|
||||||
[Depex]
|
[Depex]
|
||||||
TRUE
|
TRUE
|
@ -1,5 +1,5 @@
|
|||||||
/** @file
|
/** @file
|
||||||
This library constructs Ring 3 wrappers for the EFI_BOOT_SERVICES.
|
This driver constructs Ring 3 wrappers for the EFI_BOOT_SERVICES.
|
||||||
|
|
||||||
Copyright (c) 2024, Mikhail Krichanov. All rights reserved.
|
Copyright (c) 2024, Mikhail Krichanov. All rights reserved.
|
||||||
SPDX-License-Identifier: BSD-3-Clause
|
SPDX-License-Identifier: BSD-3-Clause
|
||||||
@ -16,81 +16,6 @@
|
|||||||
|
|
||||||
#include "Ring3.h"
|
#include "Ring3.h"
|
||||||
|
|
||||||
EFI_BOOT_SERVICES mBootServices = {
|
|
||||||
{
|
|
||||||
EFI_BOOT_SERVICES_SIGNATURE, // Signature
|
|
||||||
EFI_BOOT_SERVICES_REVISION, // Revision
|
|
||||||
sizeof (EFI_BOOT_SERVICES), // HeaderSize
|
|
||||||
0, // CRC32
|
|
||||||
0 // Reserved
|
|
||||||
},
|
|
||||||
(EFI_RAISE_TPL)Ring3RaiseTpl, // RaiseTPL
|
|
||||||
(EFI_RESTORE_TPL)Ring3RestoreTpl, // RestoreTPL
|
|
||||||
(EFI_ALLOCATE_PAGES)Ring3AllocatePages, // AllocatePages
|
|
||||||
(EFI_FREE_PAGES)Ring3FreePages, // FreePages
|
|
||||||
(EFI_GET_MEMORY_MAP)Ring3GetMemoryMap, // GetMemoryMap
|
|
||||||
(EFI_ALLOCATE_POOL)Ring3AllocatePool, // AllocatePool
|
|
||||||
(EFI_FREE_POOL)Ring3FreePool, // FreePool
|
|
||||||
(EFI_CREATE_EVENT)Ring3CreateEvent, // CreateEvent
|
|
||||||
(EFI_SET_TIMER)Ring3SetTimer, // SetTimer
|
|
||||||
(EFI_WAIT_FOR_EVENT)Ring3WaitForEvent, // WaitForEvent
|
|
||||||
(EFI_SIGNAL_EVENT)Ring3SignalEvent, // SignalEvent
|
|
||||||
(EFI_CLOSE_EVENT)Ring3CloseEvent, // CloseEvent
|
|
||||||
(EFI_CHECK_EVENT)Ring3CheckEvent, // CheckEvent
|
|
||||||
(EFI_INSTALL_PROTOCOL_INTERFACE)Ring3InstallProtocolInterface, // InstallProtocolInterface
|
|
||||||
(EFI_REINSTALL_PROTOCOL_INTERFACE)Ring3ReinstallProtocolInterface, // ReinstallProtocolInterface
|
|
||||||
(EFI_UNINSTALL_PROTOCOL_INTERFACE)Ring3UninstallProtocolInterface, // UninstallProtocolInterface
|
|
||||||
(EFI_HANDLE_PROTOCOL)Ring3HandleProtocol, // HandleProtocol
|
|
||||||
(VOID *)NULL, // Reserved
|
|
||||||
(EFI_REGISTER_PROTOCOL_NOTIFY)Ring3RegisterProtocolNotify, // RegisterProtocolNotify
|
|
||||||
(EFI_LOCATE_HANDLE)Ring3LocateHandle, // LocateHandle
|
|
||||||
(EFI_LOCATE_DEVICE_PATH)Ring3LocateDevicePath, // LocateDevicePath
|
|
||||||
(EFI_INSTALL_CONFIGURATION_TABLE)Ring3InstallConfigurationTable, // InstallConfigurationTable
|
|
||||||
(EFI_IMAGE_LOAD)Ring3LoadImage, // LoadImage
|
|
||||||
(EFI_IMAGE_START)Ring3StartImage, // StartImage
|
|
||||||
(EFI_EXIT)Ring3Exit, // Exit
|
|
||||||
(EFI_IMAGE_UNLOAD)Ring3UnloadImage, // UnloadImage
|
|
||||||
(EFI_EXIT_BOOT_SERVICES)Ring3ExitBootServices, // ExitBootServices
|
|
||||||
(EFI_GET_NEXT_MONOTONIC_COUNT)Ring3GetNextMonotonicCount, // GetNextMonotonicCount
|
|
||||||
(EFI_STALL)Ring3Stall, // Stall
|
|
||||||
(EFI_SET_WATCHDOG_TIMER)Ring3SetWatchdogTimer, // SetWatchdogTimer
|
|
||||||
(EFI_CONNECT_CONTROLLER)Ring3ConnectController, // ConnectController
|
|
||||||
(EFI_DISCONNECT_CONTROLLER)Ring3DisconnectController, // DisconnectController
|
|
||||||
(EFI_OPEN_PROTOCOL)Ring3OpenProtocol, // OpenProtocol
|
|
||||||
(EFI_CLOSE_PROTOCOL)Ring3CloseProtocol, // CloseProtocol
|
|
||||||
(EFI_OPEN_PROTOCOL_INFORMATION)Ring3OpenProtocolInformation, // OpenProtocolInformation
|
|
||||||
(EFI_PROTOCOLS_PER_HANDLE)Ring3ProtocolsPerHandle, // ProtocolsPerHandle
|
|
||||||
(EFI_LOCATE_HANDLE_BUFFER)Ring3LocateHandleBuffer, // LocateHandleBuffer
|
|
||||||
(EFI_LOCATE_PROTOCOL)Ring3LocateProtocol, // LocateProtocol
|
|
||||||
(EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES)Ring3InstallMultipleProtocolInterfaces, // InstallMultipleProtocolInterfaces
|
|
||||||
(EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES)Ring3UninstallMultipleProtocolInterfaces, // UninstallMultipleProtocolInterfaces
|
|
||||||
(EFI_CALCULATE_CRC32)Ring3CalculateCrc32, // CalculateCrc32
|
|
||||||
(EFI_COPY_MEM)CopyMem, // CopyMem
|
|
||||||
(EFI_SET_MEM)SetMem, // SetMem
|
|
||||||
(EFI_CREATE_EVENT_EX)Ring3CreateEventEx, // CreateEventEx
|
|
||||||
};
|
|
||||||
|
|
||||||
EFI_BOOT_SERVICES *gBS = &mBootServices;
|
|
||||||
|
|
||||||
/**
|
|
||||||
The function constructs Ring 3 wrappers for the EFI_BOOT_SERVICES.
|
|
||||||
|
|
||||||
@param ImageHandle The firmware allocated handle for the EFI image.
|
|
||||||
@param SystemTable A pointer to the EFI System Table.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
UefiBootServicesTableLibConstructor (
|
|
||||||
IN EFI_HANDLE ImageHandle,
|
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return EFI_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
EFI_TPL
|
EFI_TPL
|
||||||
EFIAPI
|
EFIAPI
|
||||||
Ring3RaiseTpl (
|
Ring3RaiseTpl (
|
@ -1,62 +0,0 @@
|
|||||||
/** @file
|
|
||||||
|
|
||||||
Copyright (c) 2024, Mikhail Krichanov. All rights reserved.
|
|
||||||
SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
|
|
||||||
**/
|
|
||||||
|
|
||||||
#include <Uefi.h>
|
|
||||||
#include <Library/UefiBootServicesTableLib.h>
|
|
||||||
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
Ring3Call (
|
|
||||||
IN VOID *Dummy,
|
|
||||||
IN VOID *EntryPoint,
|
|
||||||
IN EFI_HANDLE ImageHandle,
|
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
|
||||||
);
|
|
||||||
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
SysCall (
|
|
||||||
IN UINT8 Type,
|
|
||||||
...
|
|
||||||
);
|
|
||||||
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
Ring3EntryPoint (
|
|
||||||
IN EFI_HANDLE ImageHandle,
|
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
|
||||||
)
|
|
||||||
{
|
|
||||||
RING3_DATA *Ring3Data;
|
|
||||||
|
|
||||||
Ring3Data = (RING3_DATA *)SystemTable;
|
|
||||||
|
|
||||||
Ring3Data->EntryPoint = (VOID *)Ring3Call;
|
|
||||||
Ring3Data->BootServices = gBS;
|
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
Ring3Call (
|
|
||||||
IN VOID *Dummy,
|
|
||||||
IN VOID *EntryPoint,
|
|
||||||
IN EFI_HANDLE ImageHandle,
|
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
|
||||||
)
|
|
||||||
{
|
|
||||||
EFI_IMAGE_ENTRY_POINT Function;
|
|
||||||
|
|
||||||
Function = (EFI_IMAGE_ENTRY_POINT)EntryPoint;
|
|
||||||
|
|
||||||
Function (ImageHandle, SystemTable);
|
|
||||||
|
|
||||||
SysCall (SysCallReturnToCore);
|
|
||||||
|
|
||||||
return EFI_UNSUPPORTED;
|
|
||||||
}
|
|
@ -1,41 +0,0 @@
|
|||||||
## @file
|
|
||||||
# Ring 3 wrapper for UEFI Boot Services Table Library implementation.
|
|
||||||
#
|
|
||||||
# Copyright (c) 2024, Mikhail Krichanov. All rights reserved.
|
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
#
|
|
||||||
#
|
|
||||||
##
|
|
||||||
|
|
||||||
[Defines]
|
|
||||||
INF_VERSION = 0x00010005
|
|
||||||
BASE_NAME = Ring3UefiBootServicesTableLib
|
|
||||||
MODULE_UNI_FILE = Ring3UefiBootServicesTableLib.uni
|
|
||||||
FILE_GUID = b503b4b4-6dc1-412b-965f-a0f330b1d453
|
|
||||||
MODULE_TYPE = UEFI_DRIVER
|
|
||||||
VERSION_STRING = 1.0
|
|
||||||
LIBRARY_CLASS = UefiBootServicesTableLib|DXE_DRIVER DXE_RUNTIME_DRIVER UEFI_APPLICATION UEFI_DRIVER
|
|
||||||
|
|
||||||
CONSTRUCTOR = UefiBootServicesTableLibConstructor
|
|
||||||
|
|
||||||
#
|
|
||||||
# VALID_ARCHITECTURES = IA32 X64 EBC
|
|
||||||
#
|
|
||||||
|
|
||||||
[Sources]
|
|
||||||
Ring3.h
|
|
||||||
Ring3UefiBootServicesTableLib.c
|
|
||||||
|
|
||||||
[Sources.X64]
|
|
||||||
X64/SysCall.nasm
|
|
||||||
|
|
||||||
[Packages]
|
|
||||||
MdePkg/MdePkg.dec
|
|
||||||
|
|
||||||
[LibraryClasses]
|
|
||||||
BaseMemoryLib
|
|
||||||
DebugLib
|
|
||||||
|
|
||||||
[Protocols]
|
|
||||||
gEfiDevicePathUtilitiesProtocolGuid ## SOMETIMES_CONSUMES
|
|
||||||
gEfiLoadedImageProtocolGuid ## SOMETIMES_CONSUMES
|
|
@ -1,12 +0,0 @@
|
|||||||
// /** @file
|
|
||||||
// Ring 3 wrapper for UEFI Boot Services Table Library implementation.
|
|
||||||
//
|
|
||||||
// Copyright (c) 2024, Mikhail Krichanov. All rights reserved.
|
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
//
|
|
||||||
// **/
|
|
||||||
|
|
||||||
|
|
||||||
#string STR_MODULE_ABSTRACT #language en-US "Ring 3 wrapper for UEFI Boot Services Table Library implementation."
|
|
||||||
|
|
||||||
#string STR_MODULE_DESCRIPTION #language en-US "Ring 3 wrapper for UEFI Boot Services Table Library implementation."
|
|
Loading…
x
Reference in New Issue
Block a user