149 Commits

Author SHA1 Message Date
Mikhail Krichanov
3664e7206d Ring3: Renamed Ring3 as UserSpace. 2025-04-14 13:17:36 +03:00
Mikhail Krichanov
b01769d4c0 SysCall: Refactored UserStackTop to allocate it anew for each CallRing3. 2025-04-14 13:12:14 +03:00
Mikhail Krichanov
fd4fbf2a26 SysCall: Added NumberOfCalls to USER_SPACE_DRIVER. 2025-04-14 13:12:14 +03:00
Mikhail Krichanov
d7c10198ac SysCall: Fixed paddings, renamed CoreOpenVolume as
CoreSimpleFileSystemOpenVolume.
2025-04-14 13:12:14 +03:00
Mikhail Krichanov
b13baeb518 Ring3: Refactored out SysCallStackTop. 2025-04-14 13:12:14 +03:00
Mikhail Krichanov
502bafe41b Ring3: Added NumberOfArguments to SysCall() and CallBootService(). 2025-04-14 13:12:14 +03:00
Mikhail Krichanov
213713f790 Ring3: Saved ReturnSP on SysCallStack. 2025-04-14 13:12:14 +03:00
Mikhail Krichanov
2601648b32 Ring3: Refactored out CoreRsp and UserStackTop. 2025-04-14 13:12:14 +03:00
Mikhail Krichanov
ae0465017f SysCall: Refactored out mRing3CallStackTop and mCoreSysCallStackTop. 2025-04-14 13:12:14 +03:00
Mikhail Krichanov
8587830d67 SysCall: Refactored out CORE_STACK and RING3_STACK. 2025-04-14 13:12:14 +03:00
Mikhail Krichanov
ea41000bcf Ring3: Fixed line endings. 2025-04-14 13:12:12 +03:00
Mikhail Krichanov
79d8607366 Ring3: Refactored out gCoreSysCallStackTop and gRing3CallStackTop. 2025-04-14 13:06:18 +03:00
Mikhail Krichanov
99b902bde1 Ring3: Refactored User and SysCall stacks allocation. 2025-04-14 13:06:18 +03:00
Mikhail Krichanov
6ad66cc634 Ring3: Split Page Table template construction and initialization,
removed ChangeUefiImageRing(), added GetUefiImageRecord().
2025-04-14 12:54:02 +03:00
Mikhail Krichanov
51447148b0 Ring3: Added support for separate User address space. 2025-04-14 12:50:53 +03:00
Mikhail Krichanov
4403a40236 Ring3: Added support for USER attribute in .fdf files. 2025-04-14 12:50:51 +03:00
Mikhail Krichanov
cd64c7e0a6 Core/Dxe: Refactored DisableSMAP(), EnableSMAP() names. 2025-04-14 12:12:47 +03:00
Mikhail Krichanov
8104e4543c Ring3: Refactored SysCallBootService() out of EFI_BOOT_SERVICES. 2025-04-14 11:52:51 +03:00
Mikhail Krichanov
393298742c Ring3: Defined SysCallBootService() for AARCH64. 2025-04-14 11:52:48 +03:00
Mikhail Krichanov
e40c47a69c Ring3: Defined CallRing3() for AARCH64. 2025-04-14 11:49:21 +03:00
Mikhail Krichanov
a60692fa72 Ring3: Initialized DxeRing3 with Supervisor privileges. 2025-04-14 11:49:21 +03:00
Mikhail Krichanov
8ca773c920 Ring3: Moved platform dependant initialization to separate files. 2025-04-14 11:36:10 +03:00
Mikhail Krichanov
507435e9f5 Ring3: Properly freed Ring3 resources. 2025-04-14 11:36:10 +03:00
Mikhail Krichanov
28221fe295 Ring3: Added FreeProtocolsList(). 2025-04-14 11:36:10 +03:00
Mikhail Krichanov
cac7056c3e Ring3: Moved InitializeRing3() to SysCall directory. 2025-04-14 11:36:10 +03:00
Mikhail Krichanov
20722176d3 Ring3: Refactored out AllocateRing3Copy(). 2025-04-14 11:36:09 +03:00
Mikhail Krichanov
1a1afc8ce7 Ring3: Added PrepareRing3Interface(). 2025-04-14 11:36:09 +03:00
Mikhail Krichanov
3108a4b0f4 MdeModulePkg: Moved IsPoolTypeToGuard(), CoreAcquireLockOrFail(),
CoreReleaseLock() and CoreAcquireLock() to MemoryPoolLib.
2025-04-14 11:36:09 +03:00
Mikhail Krichanov
342ff29fca MdeModulePkg: Placed Core Pool functions into MemoryPoolLib. 2025-04-14 11:36:09 +03:00
Mikhail Krichanov
13d7a33127 Ring3: Refactored AllocateRing3CopyPages() and mUserDriverBinding. 2025-04-14 11:36:09 +03:00
Mikhail Krichanov
f0fb2003a2 Ring3: Refactored CallRing3(). 2025-04-14 11:36:09 +03:00
Mikhail Krichanov
702adc6292 Ring3: Refactored Ring3 initialization. 2025-04-14 11:23:05 +03:00
Mikhail Krichanov
27c04bb224 Ring3: Moved Ring3UefiBootServicesTableLib to Ring3Dxe. 2025-04-14 11:23:05 +03:00
Mikhail Krichanov
8a16ce73a7 Ring3: Refactored EnterUserImage() into CallRing3(). 2025-04-14 11:23:05 +03:00
Mikhail Krichanov
2392881e22 Ring3: Added Ring3EntryPoint draft. 2025-04-14 11:23:05 +03:00
Mikhail Krichanov
028342cb6b Ring3: Refactored stack operations. 2025-04-14 11:23:05 +03:00
Mikhail Krichanov
9d5ef4f68e Ring3: Refactored out FunctionAddress from API. 2025-04-14 11:23:05 +03:00
Mikhail Krichanov
b0c91ce70c Ring3: Refactored out AllocateRing3Pages() BootService. 2025-04-14 11:23:05 +03:00
Mikhail Krichanov
926f1b1b69 Ring3: Moved SysCall code to DxeCore. 2025-04-14 11:23:05 +03:00
Mikhail Krichanov
e170598395 Ring3: Added helper function AllocateRing3Pages() and
draft of Ring3LocateProtocol().
2025-04-14 11:23:05 +03:00
Mikhail Krichanov
51e2c2a3e8 Ring3: Added EnterUserImage(). 2025-04-14 11:23:01 +03:00
Mikhail Krichanov
62eb73d711 Ring3: Added IsUserImage field into LOADED_IMAGE_PRIVATE_DATA structure. 2025-04-14 11:21:17 +03:00
Mikhail Krichanov
992385e15e SecurePE: Defined new PcdImageProtectionPolicy. 2025-04-07 12:30:28 +03:00
Mikhail Krichanov
1fef202932 MdePkg/UefiImageLib: Introduce DebugAddress
Signed-off-by: Marvin Häuser <mhaeuser@posteo.de>
2025-04-07 12:24:27 +03:00
Marvin Häuser
ec35a44c1e MdeModulePkg/DxeCore: Re-use ImageIsFromFv for memory protection 2025-04-07 12:24:27 +03:00
Mikhail Krichanov
51c4b78146 Revert "MdeModulePkg: Enable forward edge CFI in mem attributes table"
This reverts commit e4ef609319236a018c60b84f68d9d923c4ba383e.
2025-04-07 12:24:27 +03:00
Mikhail Krichanov
20dd836214 MdeModulePkg/Core/Dxe: Integrate CPU Architectural producer
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3223

In the current design, memory protection is not available till CpuDxe
is loaded. To resolve this, introduce CpuArchLib to move the
CPU Architectural initialization to DxeCore.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Vitaly Cheptsov <vit9696@protonmail.com>
Signed-off-by: Marvin Häuser <mhaeuser@posteo.de>
2025-04-07 12:23:28 +03:00
Mikhail Krichanov
09a0c067d0 SecurePE: Replaced old PE loader with Secure one. 2025-04-07 12:12:35 +03:00
Xiaoqiang Zhang
0596e5fa05 MdeModulePkg: CoreValidateHandle Optimization
REF : https://bugzilla.tianocore.org/show_bug.cgi?id=4817

Before entering BIOS setup, CoreValidateHandle function executed
over 600,000 times during BDS phase on latest 8S server platform.
In CoreValidateHandle function, current implementation will go
through the doubly-linked list handle database in each call, and
this will have big impact on boot performance.
The optimization is using Red-black tree to store the EFI handle
address when insert each EFI handle into the handle database, and
remove the handle from Red-black tree if the handle is removed
from the handle database. CoreValidateHandle function changed to
go through the Red-black tree.
After verification on latest 8S server platform, BDS boot time can
save 20s+ after this change.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Andrew Fish <afish@apple.com>
Tested-by: Xiaoqiang Zhang <xiaoqiang.zhang@intel.com>
2024-08-30 11:42:41 +00:00
Michael D Kinney
af6e0e728f MdeModulePkg/Core/Dxe: Set MemoryTypeInfo bin range from HOB
Provide an optional method for PEI to declare a specific address
range to use for the Memory Type Information bins. The current
algorithm uses heuristics that tends to place the Memory Type
Information bins in the same location, but memory configuration
changes across boots or algorithm changes across a firmware
updates could potentially change the Memory Type Information bin
location. If the bin locations move across an S4 save/resume
cycle, then the S4 resume may fail. Enabling this feature
increases the number of scenarios that an S4 resume operation
may succeed.

If the HOB List contains a Resource Descriptor HOB that
describes tested system memory and has an Owner GUID of
gEfiMemoryTypeInformationGuid, then use the address range
described by the Resource Descriptor HOB as the preferred
location of the Memory Type Information bins. If this HOB is
not detected, then the current behavior is preserved.

The HOB with an Owner GUID of gEfiMemoryTypeInformationGuid
is ignored for the following conditions:
* The HOB with an Owner GUID of gEfiMemoryTypeInformationGuid
  is smaller than the Memory Type Information bins.
* The HOB list contains more than one Resource Descriptor HOB
  with an owner GUID of gEfiMemoryTypeInformationGuid.
* The Resource Descriptor HOB with an Owner GUID of
  gEfiMemoryTypeInformationGuid is the same Resource Descriptor
  HOB that that describes the PHIT memory range.

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Aaron Li <aaron.li@intel.com>
Cc: Liu Yun <yun.y.liu@intel.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2024-01-30 18:30:02 +00:00