• XSS.stack #1 – первый литературный журнал от юзеров форума

UEFI concepts Part 1

RtlGBI

CD-диск
Пользователь
Регистрация
01.12.2022
Сообщения
13
Реакции
2
1 - SEC (Security) phase: Handles CPU initialization to create stack cpu cache
"When it reaches the (1)"SEC" stage, it only works to initialize the internal resources of the CPU for several reasons that I do not want to mention now."
2 - CAR (Cache As RAM) : When use it as a memory called CAR.
3 - PEI(Pre-EFI initialization) : Finishes CPU initialization. And a way to load and call configuration actions Processor (2) give control to dxe
4 - EFI_SEC_PEI_HAND_OFF : Contains information about "PEI" such as size, memory location, stack location and location BFV
C++:
typedef struct _EFI_SEC_PEI_HAND_OFF{
  UINT16  DataSize; // size of data structure
  VOID    *BootFirmwareVolumeBase; // points to the first byte of the boot firmware volume where the pei
  UINTN   BootFirmwareVolumeSize;// size of boot firmware in bytes
  VOID    *TemporaryRamBase;// points to the first byte of temporary RAM
  UINTN   TemporaryRamSize; // size temporary RAM
  VOID    *PeiTemporaryRamBase; // points to the first byte of temporary RAM usable by PEI
  UINTN   PeiTemporaryRamSize; //size temporary RAM available to PEI Foundation
  VOID    *StackBase; // point to first byte of the stack
  UINTN   StackSize;// size of stack base
}EFI_SEC_PEI_HAND_OFF;
5 - EFI_FIRMWARE_VOLUME_HEADER* : points to data structure have a information about PEI() (size and location )
C++:
[LIST=1]
[*]typedef struct {
[*]  ///
[*]  /// The first 16 bytes are reserved to allow for the reset vector of
[*]  /// processors whose reset vector is at address 0.
[*]  ///
[*]  UINT8                     ZeroVector[16];
[*]  ///
[*]  /// Declares the file system with which the firmware volume is formatted.
[*]  ///
[*]  EFI_GUID                  FileSystemGuid;
[*]  ///
[*]  /// Length in bytes of the complete firmware volume, including the header.
[*]  ///
[*]  UINT64                    FvLength;
[*]  ///
[*]  /// Set to EFI_FVH_SIGNATURE
[*]  ///
[*]  UINT32                    Signature;
[*]  ///
[*]  /// Declares capabilities and power-on defaults for the firmware volume.
[*]  ///
[*]  EFI_FVB_ATTRIBUTES_2      Attributes;
[*]  ///
[*]  /// Length in bytes of the complete firmware volume header.
[*]  ///
[*]  UINT16                    HeaderLength;
[*]  ///
[*]  /// A 16-bit checksum of the firmware volume header. A valid header sums to zero.
[*]  ///
[*]  UINT16                    Checksum;
[*]  ///
[*]  /// Offset, relative to the start of the header, of the extended header
[*]  /// (EFI_FIRMWARE_VOLUME_EXT_HEADER) or zero if there is no extended header.
[*]  ///
[*]  UINT16                    ExtHeaderOffset;
[*]  ///
[*]  /// This field must always be set to zero.
[*]  ///
[*]  UINT8                     Reserved[1];
[*]  ///
[*]  /// Set to 2. Future versions of this specification may define new header fields and will
[*]  /// increment the Revision field accordingly.
[*]  ///
[*]  UINT8                     Revision;
[*]  ///
[*]  /// An array of run-length encoded FvBlockMapEntry structures. The array is
[*]  /// terminated with an entry of {0,0}.
[*]  ///
[*]  EFI_FV_BLOCK_MAP_ENTRY    BlockMap[1];
[*]} EFI_FIRMWARE_VOLUME_HEADER;
[/LIST]
after entering the "SEC Phase" area,first use "CAR" is used to initialize the stack, "IDT" and "EFI_SEC" and transfer control to "PEI" and pass "EFI_SEC_PEI_HAND_OFF" to "PEI"
1 - SEC
Initialize the temporary storage area
Receive and process system startup and restart

2 - PEI
the resources in the PEI Stage are still limited and the memory is not initized until the later stage of PEI Its main task is to prepare an environment for the implementation of "DXE" and to form a list of "HOB" with the information that must be passed to "DXE" and now the control of "DXE"

PEI Kernel : Responsible for basic services and operations in "PEI"
PEIM (PEIM)odule : The main function is to find out all PEIM The initialization of the system in the PEI phase is mainly completed by PEIM

entry function PEIM :
C++:
typedef EFI_STATUS (EFIAPI *EFI_PEIM_ENTRY_POINT2)(   IN EFI_PEI_FILE_HANDLE             FileHandle,   IN CONST EFI_PEI_SERVICES          **PeiServices   );
Through PeiServices PEIM can use the systemService provided by the PEI and access PEI Kernel, Communication between PEIM is through PPI

3. DXE[Driver Execution Environment]
performs most of the system initialization work When entering this stage, the memory can be fully used, so there are many complications at this stage


Boot process of UEFI system

PEI, functionally, DXE can be divided into the following 2 parts

DXE Kernel : Responsible for DXE some services and execution processes
DXE dispatcher : Responsible for scheduling and executing DXE drivers and initializing system devices.

4 - BDS (Boot Device Selection)
execute the boot strategy
Loads and executes startup items according to system settings.
Policies are configured through global variables "NVRAM ". this variable can be read via GetVariable() of runtime service and set via "SetVariable()"
C++:
SystemTable->RuntimeServices->GetVariable(TEXT, guid, attr, data_size, data);
SystemTable->RuntimeServices->SetVariable(TEXT,guid,ACCESS,size,data);

5 - TSL (Transient System Load)
first stage of os loader,in the stage OS Loader run as UEFI Application, and system resources are still controlled by the UEFI kernel when the ExitBootServices() when service is called enters the run-time phase
It prepares the execution environment for the operating system, which is a temporary system, but its functions are very powerful By default it does not enter UEFI Shell enters when an error occurs
6 - RT(Run-Time)
When the system enters "RT", the control is transferred from "UEFI Kernel" to "OS Loader"
7 - AL(after life)
When the operating system invokes "ResetSystem()" it enters a phase state AL

C++:
SystemTable->RuntimeServices->ResetSystem(EfiResetShutdown, EFI_SUCCESS, NULL, NULL);
return EFI_SUCCESS;
 


Напишите ответ...
  • Вставить:
Прикрепить файлы
Верх