mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-25 22:54:51 +02:00
Ring3: Initialized DxeRing3 with Supervisor privileges.
This commit is contained in:
parent
6dc6cd62d4
commit
d1fa366ba2
@ -2635,6 +2635,20 @@ UnprotectUefiImage (
|
|||||||
IN EFI_DEVICE_PATH_PROTOCOL *LoadedImageDevicePath
|
IN EFI_DEVICE_PATH_PROTOCOL *LoadedImageDevicePath
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Change UEFI image owner: Supervisor / Privileged or User / Unprivileged.
|
||||||
|
|
||||||
|
@param[in] LoadedImage The loaded image protocol
|
||||||
|
@param[in] LoadedImageDevicePath The loaded image device path protocol
|
||||||
|
@param[in] IsUser Whether UEFI image record is User Image.
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
ChangeUefiImageRing (
|
||||||
|
IN EFI_LOADED_IMAGE_PROTOCOL *LoadedImage,
|
||||||
|
IN EFI_DEVICE_PATH_PROTOCOL *LoadedImageDevicePath,
|
||||||
|
IN BOOLEAN IsUser
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
ExitBootServices Callback function for memory protection.
|
ExitBootServices Callback function for memory protection.
|
||||||
**/
|
**/
|
||||||
|
@ -294,6 +294,44 @@ UnprotectUefiImage (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Change UEFI image owner: Supervisor / Privileged or User / Unprivileged.
|
||||||
|
|
||||||
|
@param[in] LoadedImage The loaded image protocol
|
||||||
|
@param[in] LoadedImageDevicePath The loaded image device path protocol
|
||||||
|
@param[in] IsUser Whether UEFI image record is User Image.
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
ChangeUefiImageRing (
|
||||||
|
IN EFI_LOADED_IMAGE_PROTOCOL *LoadedImage,
|
||||||
|
IN EFI_DEVICE_PATH_PROTOCOL *LoadedImageDevicePath,
|
||||||
|
IN BOOLEAN IsUser
|
||||||
|
)
|
||||||
|
{
|
||||||
|
UEFI_IMAGE_RECORD *ImageRecord;
|
||||||
|
LIST_ENTRY *ImageRecordLink;
|
||||||
|
|
||||||
|
for (ImageRecordLink = mProtectedImageRecordList.ForwardLink;
|
||||||
|
ImageRecordLink != &mProtectedImageRecordList;
|
||||||
|
ImageRecordLink = ImageRecordLink->ForwardLink)
|
||||||
|
{
|
||||||
|
ImageRecord = CR (
|
||||||
|
ImageRecordLink,
|
||||||
|
UEFI_IMAGE_RECORD,
|
||||||
|
Link,
|
||||||
|
UEFI_IMAGE_RECORD_SIGNATURE
|
||||||
|
);
|
||||||
|
|
||||||
|
if (ImageRecord->StartAddress == (EFI_PHYSICAL_ADDRESS)(UINTN)LoadedImage->ImageBase) {
|
||||||
|
ASSERT (gCpu != NULL);
|
||||||
|
|
||||||
|
SetUefiImageProtectionAttributes (ImageRecord, IsUser);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Return the EFI memory permission attribute associated with memory
|
Return the EFI memory permission attribute associated with memory
|
||||||
type 'MemoryType' under the configured DXE memory protection policy.
|
type 'MemoryType' under the configured DXE memory protection policy.
|
||||||
|
@ -50,9 +50,15 @@ InitializeRing3 (
|
|||||||
gRing3Data = (RING3_DATA *)(UINTN)Physical;
|
gRing3Data = (RING3_DATA *)(UINTN)Physical;
|
||||||
|
|
||||||
CopyMem ((VOID *)gRing3Data, (VOID *)Image->Info.SystemTable, sizeof (EFI_SYSTEM_TABLE));
|
CopyMem ((VOID *)gRing3Data, (VOID *)Image->Info.SystemTable, sizeof (EFI_SYSTEM_TABLE));
|
||||||
|
//
|
||||||
|
// Initialize DxeRing3 with Supervisor privileges.
|
||||||
|
//
|
||||||
|
ChangeUefiImageRing (&Image->Info, Image->LoadedImageDevicePath, FALSE);
|
||||||
|
|
||||||
Status = Image->EntryPoint (ImageHandle, (EFI_SYSTEM_TABLE *)gRing3Data);
|
Status = Image->EntryPoint (ImageHandle, (EFI_SYSTEM_TABLE *)gRing3Data);
|
||||||
|
|
||||||
|
ChangeUefiImageRing (&Image->Info, Image->LoadedImageDevicePath, TRUE);
|
||||||
|
|
||||||
gRing3EntryPoint = gRing3Data->EntryPoint;
|
gRing3EntryPoint = gRing3Data->EntryPoint;
|
||||||
|
|
||||||
gRing3Data->SystemTable.BootServices = gRing3Data->BootServices;
|
gRing3Data->SystemTable.BootServices = gRing3Data->BootServices;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user