2009-12-06 02:57:05 +01:00
|
|
|
#/** @file
|
2014-08-19 15:29:52 +02:00
|
|
|
#
|
2009-12-06 02:57:05 +01:00
|
|
|
# DXE CPU driver
|
2014-08-19 15:29:52 +02:00
|
|
|
#
|
2010-04-29 14:15:47 +02:00
|
|
|
# Copyright (c) 2009, Apple Inc. All rights reserved.<BR>
|
2013-07-18 08:20:33 +02:00
|
|
|
# Copyright (c) 2011-2013, ARM Limited. All rights reserved.
|
2011-06-20 23:35:50 +02:00
|
|
|
#
|
2019-04-04 01:03:18 +02:00
|
|
|
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
2014-08-19 15:29:52 +02:00
|
|
|
#
|
2009-12-06 02:57:05 +01:00
|
|
|
#**/
|
|
|
|
|
|
|
|
[Defines]
|
|
|
|
INF_VERSION = 0x00010005
|
|
|
|
BASE_NAME = ArmCpuDxe
|
|
|
|
FILE_GUID = B8D9777E-D72A-451F-9BDB-BAFB52A68415
|
|
|
|
MODULE_TYPE = DXE_DRIVER
|
|
|
|
VERSION_STRING = 1.0
|
|
|
|
|
|
|
|
ENTRY_POINT = CpuDxeInitialize
|
|
|
|
|
2012-09-28 12:52:16 +02:00
|
|
|
[Sources.Common]
|
2009-12-06 02:57:05 +01:00
|
|
|
CpuDxe.c
|
|
|
|
CpuDxe.h
|
2013-07-18 08:20:33 +02:00
|
|
|
CpuMmuCommon.c
|
2016-03-07 16:16:38 +01:00
|
|
|
Exception.c
|
2023-01-31 23:26:25 +01:00
|
|
|
MemoryAttribute.c
|
2010-01-08 22:12:20 +01:00
|
|
|
|
2012-09-28 12:52:16 +02:00
|
|
|
[Sources.ARM]
|
2015-12-15 10:56:04 +01:00
|
|
|
Arm/Mmu.c
|
2009-12-06 02:57:05 +01:00
|
|
|
|
2013-07-18 20:07:46 +02:00
|
|
|
[Sources.AARCH64]
|
|
|
|
AArch64/Mmu.c
|
2010-01-27 03:47:47 +01:00
|
|
|
|
2009-12-06 02:57:05 +01:00
|
|
|
[Packages]
|
|
|
|
ArmPkg/ArmPkg.dec
|
|
|
|
EmbeddedPkg/EmbeddedPkg.dec
|
|
|
|
MdePkg/MdePkg.dec
|
2011-06-20 23:35:50 +02:00
|
|
|
MdeModulePkg/MdeModulePkg.dec
|
2009-12-06 02:57:05 +01:00
|
|
|
|
|
|
|
[LibraryClasses]
|
2011-09-23 01:14:01 +02:00
|
|
|
ArmLib
|
2016-06-16 11:51:10 +02:00
|
|
|
ArmMmuLib
|
2009-12-06 02:57:05 +01:00
|
|
|
BaseMemoryLib
|
|
|
|
CacheMaintenanceLib
|
2011-09-23 00:53:54 +02:00
|
|
|
CpuLib
|
2016-03-07 16:16:38 +01:00
|
|
|
CpuExceptionHandlerLib
|
2011-09-23 00:53:54 +02:00
|
|
|
DebugLib
|
|
|
|
DefaultExceptionHandlerLib
|
2010-01-14 04:25:08 +01:00
|
|
|
DxeServicesTableLib
|
2011-09-23 01:14:01 +02:00
|
|
|
HobLib
|
ArmPkg/CpuDxe: Perform preliminary NX remap of free memory
The DXE core implementation of PcdDxeNxMemoryProtectionPolicy already
contains an assertion that EfiConventionalMemory and EfiBootServicesData
are subjected to the same policy when it comes to the use of NX
permissions. The reason for this is that we may otherwise end up with
unbounded recursion in the page table code, given that allocating a page
table would then involve a permission attribute change, and this could
result in the need for a block entry to be split, which would trigger
the allocation of a page table recursively.
For the same reason, a shortcut exists in ApplyMemoryProtectionPolicy()
where, instead of setting the memory attributes unconditionally, we
compare the NX policies and avoid touching the page tables if they are
the same for the old and the new memory types. Without this shortcut, we
may end up in a situation where, as the CPU arch protocol DXE driver is
ramping up, the same unbounded recursion is triggered, due to the fact
that the NX policy for EfiConventionalMemory has not been applied yet.
To break this cycle, let's remap all EfiConventionalMemory regions
according to the NX policy for EfiBootServicesData before exposing the
CPU arch protocol to the DXE core and other drivers. This ensures that
creating EfiBootServicesData allocations does not result in memory
attribute changes, and therefore no recursion.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com>
2023-02-08 16:34:33 +01:00
|
|
|
MemoryAllocationLib
|
2010-01-14 04:25:08 +01:00
|
|
|
PeCoffGetEntryPointLib
|
2011-09-23 01:14:01 +02:00
|
|
|
UefiDriverEntryPoint
|
2010-01-14 04:25:08 +01:00
|
|
|
UefiLib
|
2009-12-06 02:57:05 +01:00
|
|
|
|
|
|
|
[Protocols]
|
|
|
|
gEfiCpuArchProtocolGuid
|
2023-01-31 23:26:25 +01:00
|
|
|
gEfiMemoryAttributeProtocolGuid
|
2010-01-14 04:25:08 +01:00
|
|
|
|
|
|
|
[Guids]
|
|
|
|
gEfiDebugImageInfoTableGuid
|
2011-09-23 01:14:01 +02:00
|
|
|
gArmMpCoreInfoGuid
|
2011-06-20 23:35:50 +02:00
|
|
|
gIdleLoopEventGuid
|
2016-03-07 16:16:38 +01:00
|
|
|
gEfiVectorHandoffTableGuid
|
2009-12-06 02:57:05 +01:00
|
|
|
|
|
|
|
[Pcd.common]
|
2011-02-02 23:35:30 +01:00
|
|
|
gArmTokenSpaceGuid.PcdVFPEnabled
|
ArmPkg/CpuDxe: Perform preliminary NX remap of free memory
The DXE core implementation of PcdDxeNxMemoryProtectionPolicy already
contains an assertion that EfiConventionalMemory and EfiBootServicesData
are subjected to the same policy when it comes to the use of NX
permissions. The reason for this is that we may otherwise end up with
unbounded recursion in the page table code, given that allocating a page
table would then involve a permission attribute change, and this could
result in the need for a block entry to be split, which would trigger
the allocation of a page table recursively.
For the same reason, a shortcut exists in ApplyMemoryProtectionPolicy()
where, instead of setting the memory attributes unconditionally, we
compare the NX policies and avoid touching the page tables if they are
the same for the old and the new memory types. Without this shortcut, we
may end up in a situation where, as the CPU arch protocol DXE driver is
ramping up, the same unbounded recursion is triggered, due to the fact
that the NX policy for EfiConventionalMemory has not been applied yet.
To break this cycle, let's remap all EfiConventionalMemory regions
according to the NX policy for EfiBootServicesData before exposing the
CPU arch protocol to the DXE core and other drivers. This ensures that
creating EfiBootServicesData allocations does not result in memory
attribute changes, and therefore no recursion.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com>
2023-02-08 16:34:33 +01:00
|
|
|
gEfiMdeModulePkgTokenSpaceGuid.PcdDxeNxMemoryProtectionPolicy
|
2014-08-19 15:29:52 +02:00
|
|
|
|
2009-12-06 02:57:05 +01:00
|
|
|
[FeaturePcd.common]
|
2011-06-03 11:18:00 +02:00
|
|
|
gArmTokenSpaceGuid.PcdDebuggerExceptionSupport
|
ArmPkg/CpuDxe: Perform preliminary NX remap of free memory
The DXE core implementation of PcdDxeNxMemoryProtectionPolicy already
contains an assertion that EfiConventionalMemory and EfiBootServicesData
are subjected to the same policy when it comes to the use of NX
permissions. The reason for this is that we may otherwise end up with
unbounded recursion in the page table code, given that allocating a page
table would then involve a permission attribute change, and this could
result in the need for a block entry to be split, which would trigger
the allocation of a page table recursively.
For the same reason, a shortcut exists in ApplyMemoryProtectionPolicy()
where, instead of setting the memory attributes unconditionally, we
compare the NX policies and avoid touching the page tables if they are
the same for the old and the new memory types. Without this shortcut, we
may end up in a situation where, as the CPU arch protocol DXE driver is
ramping up, the same unbounded recursion is triggered, due to the fact
that the NX policy for EfiConventionalMemory has not been applied yet.
To break this cycle, let's remap all EfiConventionalMemory regions
according to the NX policy for EfiBootServicesData before exposing the
CPU arch protocol to the DXE core and other drivers. This ensures that
creating EfiBootServicesData allocations does not result in memory
attribute changes, and therefore no recursion.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com>
2023-02-08 16:34:33 +01:00
|
|
|
gArmTokenSpaceGuid.PcdRemapUnusedMemoryNx
|
2009-12-06 02:57:05 +01:00
|
|
|
|
2011-06-20 23:30:51 +02:00
|
|
|
[Depex]
|
2018-04-11 18:52:25 +02:00
|
|
|
gHardwareInterruptProtocolGuid OR gHardwareInterrupt2ProtocolGuid
|