Newer
Older
AMI-Aptio-BIOS-Reversed / BootScriptExecutorDxe / BootScriptExecutorDxe.md
@Ajax Dong Ajax Dong 2 days ago 5 KB Init

BootScriptExecutorDxe

Function Table

Address Name Description
ModuleEntryPoint
DriverInit
BootScriptDriverInit
BootScriptExecuteTable
UefiBootServicesTableLibConstructor
SmmLockBoxSaveLockBox
SmmLockBoxRestoreLockBox
SmmLockBoxSetAttributes
X64ExceptionDumpCpuContext
BaseLibGetPerformanceCounter
Global variables
Data section variables
UINT64 gUnknownData_0xC850; / 0xC850 /
VOID gEfiBootScriptNotifyProtocol; / 0xC710 */
Module Entry Point
Driver Init - Serial port init and boot script setup
Store global pointers
Read CMOS/RTC to detect serial baud rate
CMOS index 0x5C stores the UART baud rate index:
0xA7 -> 115200, 0xA6 -> 57600, 0xA5 -> 38400
0xA4 -> 19200, 0xA3 -> 9600
IoWrite8 (RTC_ADDR_PORT, 0x5C);
Configure 16550 UART at detected base address
UART base is determined from CMOS (typically 0x3F8 for COM1)
UINT16 UartBase = 1016; / 0x3F8 /
Detect current UART configuration
Set DLAB bit to access divisor latches
Only reconfigure if baud rate doesn't match
Wait for UART idle (TSR empty)
Set DLAB, write divisor, clear DLAB, set 8N1
Allocate boot script table
PCD check: enable watchdog if appropriate
Check CR0 (cache settings)
Performance counter delay loop
Restore cache state
Call main boot script driver init
Boot Script Driver Init (from PiDxeS3BootScriptLib/BootScriptSave.c)
the boot script notification protocols.
Allocate S3 boot script context
Allocate S3 boot script table via boot services
Register with BS function table
Create DxeSmmReadyToLock event
Check if BootScript Notify protocol is available
If so, register S3 ready event and close done callbacks
Allocate second context
Allocate from S3 boot script protocol
Register boot script close callbacks
Register S3 ready callback
Boot Script Table Entry Execution
S3BootScriptExecuteTable - Main entry for executing the boot script table
Parses each entry by opcode and dispatches to the appropriate handler.
Called during S3 resume.
UINT64 BootScriptExecuteTable (
This is the core function at 0x4C94
It iterates through the boot script table entries, parsing the
common header (opcode, width, size) and dispatching to:
For the full decompiled pseudocode, see the IDB at:
BootScriptExecuteTable @ 0x4C94
UefiBootServicesTableLibConstructor @ 0x1B9C
Constructor for the UEFI Boot Services Table Library.
Stores pointer to function table.
UINT64 UefiBootServicesTableLibConstructor (
Returns the gBS function table pointer
SmmLockBoxSaveLockBox @ 0x21A4
Saves a buffer to a LockBox identified by GUID.
Uses SMM communication buffer protocol.
UINT64 SmmLockBoxSaveLockBox (
Get SMM communication buffer
Build SMM LockBox save request
Send to SMM via communication buffer
Return status
SmmLockBoxRestoreLockBox @ 0x2414
Restores a buffer from a LockBox identified by GUID.
Allocates boot services buffer for the restored data.
UINT64 SmmLockBoxRestoreLockBox (
Build LockBox restore request with SMM comm buffer
Buffer layout:
Call SMM communication protocol
Return restored data status
SmmLockBoxSetAttributes @ 0x22E8
Sets attributes on an existing LockBox.
Currently only supports EFI_LOCK_BOX_ATTRIBUTE_RESTORE_IN_PLACE (bit 0).
UINT64 SmmLockBoxSetAttributes (
Build SMM request with Attributes=4 (SetAttributes)
GUID is embedded in the request buffer
X64ExceptionDumpCpuContext @ 0x6D30
Dumps full CPU context for an X64 exception.
Called by the exception handler to print register state.
UINT64 X64ExceptionDumpCpuContext (
Exception has data (page fault, etc.)
Page fault
Dump all general purpose and system registers
BaseLibGetPerformanceCounter @ 0x19F4
Reads the current performance counter value.
Uses the TSC (Time Stamp Counter).
UINT64 BaseLibGetPerformanceCounter (
CopyMem @ 0x72EC
Copies memory from source to destination.
VOID *
Delegates to CopyMemInternal at 0x9C0
SetMem @ 0x7388
Fills memory with a byte value.
Delegates to SetMemInternal at 0xA10

Generated by HR650X BIOS Decompilation Project