[edk2-devel] [PATCH v4 15/28] ArmPkg: Use GetMemoryProtectionsLib instead of Memory Protection PCDs
Taylor Beebe
taylor.d.beebe at gmail.com
Wed Sep 20 00:57:38 UTC 2023
Replace references to the memory protection PCDs to instead
check the platform protections via GetMemoryProtectionsLib.
Signed-off-by: Taylor Beebe <taylor.d.beebe at gmail.com>
Cc: Leif Lindholm <quic_llindhol at quicinc.com>
Cc: Ard Biesheuvel <ardb+tianocore at kernel.org>
Cc: Sami Mujawar <sami.mujawar at arm.com>
---
ArmPkg/Drivers/CpuDxe/CpuDxe.c | 5 ++---
ArmPkg/ArmPkg.dsc | 1 +
ArmPkg/Drivers/CpuDxe/CpuDxe.inf | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/ArmPkg/Drivers/CpuDxe/CpuDxe.c b/ArmPkg/Drivers/CpuDxe/CpuDxe.c
index fc63e527846a..8a25e78dfebd 100644
--- a/ArmPkg/Drivers/CpuDxe/CpuDxe.c
+++ b/ArmPkg/Drivers/CpuDxe/CpuDxe.c
@@ -12,6 +12,7 @@
#include <Guid/IdleLoopEvent.h>
#include <Library/MemoryAllocationLib.h>
+#include <Library/GetMemoryProtectionsLib.h>
BOOLEAN mIsFlushingGCD;
@@ -241,7 +242,6 @@ RemapUnusedMemoryNx (
VOID
)
{
- UINT64 TestBit;
UINTN MemoryMapSize;
UINTN MapKey;
UINTN DescriptorSize;
@@ -251,8 +251,7 @@ RemapUnusedMemoryNx (
EFI_MEMORY_DESCRIPTOR *MemoryMapEnd;
EFI_STATUS Status;
- TestBit = LShiftU64 (1, EfiBootServicesData);
- if ((PcdGet64 (PcdDxeNxMemoryProtectionPolicy) & TestBit) == 0) {
+ if (!gMps.Dxe.ExecutionProtection.EnabledForType[EfiBootServicesData]) {
return;
}
diff --git a/ArmPkg/ArmPkg.dsc b/ArmPkg/ArmPkg.dsc
index 6dd91e694192..1e34ef95b7cb 100644
--- a/ArmPkg/ArmPkg.dsc
+++ b/ArmPkg/ArmPkg.dsc
@@ -57,6 +57,7 @@ [LibraryClasses.common]
PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf
+ GetMemoryProtectionsLib|MdeModulePkg/Library/GetMemoryProtectionsLib/GetMemoryProtectionsLibNull.inf
UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
diff --git a/ArmPkg/Drivers/CpuDxe/CpuDxe.inf b/ArmPkg/Drivers/CpuDxe/CpuDxe.inf
index 7d8132200e64..4d0a3de99546 100644
--- a/ArmPkg/Drivers/CpuDxe/CpuDxe.inf
+++ b/ArmPkg/Drivers/CpuDxe/CpuDxe.inf
@@ -46,6 +46,7 @@ [LibraryClasses]
CpuExceptionHandlerLib
DebugLib
DefaultExceptionHandlerLib
+ GetMemoryProtectionsLib
DxeServicesTableLib
HobLib
MemoryAllocationLib
@@ -65,7 +66,6 @@ [Guids]
[Pcd.common]
gArmTokenSpaceGuid.PcdVFPEnabled
- gEfiMdeModulePkgTokenSpaceGuid.PcdDxeNxMemoryProtectionPolicy
[FeaturePcd.common]
gArmTokenSpaceGuid.PcdDebuggerExceptionSupport
--
2.42.0.windows.2
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108877): https://edk2.groups.io/g/devel/message/108877
Mute This Topic: https://groups.io/mt/101469954/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-
More information about the edk2-devel-archive
mailing list