Skip to content

Commit 3ef1e60

Browse files
TaylorBeebeos-d
authored andcommitted
ArmPkg:CpuDxe: Use the Memory Protection HOB
Description Project Mu doesn't used the memory protection fixed at build PCDs. - [x] Impacts functionality? - **Functionality** - Does the change ultimately impact how firmware functions? - Examples: Add a new library, publish a new PPI, update an algorithm, ... - [ ] Impacts security? - **Security** - Does the change have a direct security impact on an application, flow, or firmware? - Examples: Crypto algorithm change, buffer overflow fix, parameter validation improvement, ... - [ ] Breaking change? - **Breaking change** - Will anyone consuming this change experience a break in build or boot behavior? - Examples: Add a new library class, move a module to a different repo, call a function in a new library class in a pre-existing module, ... - [ ] Includes tests? - **Tests** - Does the change include any explicit test code? - Examples: Unit tests, integration tests, robot tests, ... - [ ] Includes documentation? - **Documentation** - Does the change contain explicit documentation additions outside direct code modifications (and comments)? - Examples: Update readme file, add feature readme file, link to documentation on an a separate Web page, ... How This Was Tested Running QemuSbsaPkg Integration Instructions N/A
1 parent 9a1e08a commit 3ef1e60

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

ArmPkg/ArmPkg.dsc

+1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
ArmSvcLib|ArmPkg/Library/ArmSvcLib/ArmSvcLib.inf # MU_CHANGE
9797
SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf # MU_CHANGE
9898
NULL|MdePkg/Library/StackCheckLibNull/StackCheckLibNull.inf # MU_CHANGE: /GS and -fstack-protector support
99+
DxeMemoryProtectionHobLib|MdeModulePkg/Library/MemoryProtectionHobLibNull/DxeMemoryProtectionHobLibNull.inf # MU_CHANGE
99100

100101
[LibraryClasses.common.PEIM]
101102
HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf

ArmPkg/Drivers/CpuDxe/CpuDxe.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <Guid/IdleLoopEvent.h>
1313

1414
#include <Library/MemoryAllocationLib.h>
15+
#include <Library/DxeMemoryProtectionHobLib.h> // MU_CHANGE
1516

1617
BOOLEAN mIsFlushingGCD;
1718

@@ -252,7 +253,10 @@ RemapUnusedMemoryNx (
252253
EFI_STATUS Status;
253254

254255
TestBit = LShiftU64 (1, EfiBootServicesData);
255-
if ((PcdGet64 (PcdDxeNxMemoryProtectionPolicy) & TestBit) == 0) {
256+
// MU_CHANGE START: Use memory protection HOB instead of PCD
257+
// if ((PcdGet64 (PcdDxeNxMemoryProtectionPolicy) & TestBit) == 0) {
258+
if (gDxeMps.NxProtectionPolicy.Fields.EfiConventionalMemory == 0) {
259+
// MU_CHANGE END
256260
return;
257261
}
258262

ArmPkg/Drivers/CpuDxe/CpuDxe.inf

+2-1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
PeCoffGetEntryPointLib
5353
UefiDriverEntryPoint
5454
UefiLib
55+
DxeMemoryProtectionHobLib # MU_CHANGE
5556

5657
[Protocols]
5758
gEfiCpuArchProtocolGuid
@@ -65,7 +66,7 @@
6566

6667
[Pcd.common]
6768
gArmTokenSpaceGuid.PcdVFPEnabled
68-
gEfiMdeModulePkgTokenSpaceGuid.PcdDxeNxMemoryProtectionPolicy
69+
# gEfiMdeModulePkgTokenSpaceGuid.PcdDxeNxMemoryProtectionPolicy # MU_CHANGE
6970

7071
[FeaturePcd.common]
7172
gArmTokenSpaceGuid.PcdDebuggerExceptionSupport

0 commit comments

Comments
 (0)