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

SmiFlashDxe

Function Table

Address Name Description
ReadUnaligned64
IsHobGuidMatch
DebugPrintWithLevel
DebugAssert
UefiBootServicesTableLibConstructor
SmiFlashEntryPoint
ModuleEntryPoint
SmiHandlerFlashUnregister
SmiHandlerUnload
Global Variables (.data section, zero-initialized)
At 0x3030. Called in sequence from SmiFlashEntryPoint.
Library Support Functions (linked from BaseLib / BaseMemoryLib)
Align to 4-byte boundary
Fill 4-byte chunks
Remaining bytes
Check for overlap: if Source < Destination and overlap exists
copy from end to avoid corruption.
For small copies or overlapping alignment, go byte-by-byte
Align both pointers to 8-byte boundary
Copy 8-byte aligned chunks
Library Support: HobLib
Handle unaligned head
Compare in 8-byte words
Remaining byte comparison
HOB GUID low half
HOB GUID high half
Target low half
Target high half (duplicate)
SMM Debug Protocol (library-level support)
Read debug level from CMOS
Boot Services Table Constructor
Save secondary copies for SMI handler management
Create cleanup event
Register protocol notify for SMM base protocol
SMI Handler Entry Point
Store SystemTable locally if not already done
Scan configuration table for flash descriptor HOB
The HOB table is stored as a flat array accessible via the
SMM System Table configuration table.
RegionType = 0;
Walk HOB entries looking for FLASH_DESCRIPTOR_HOB_GUID
Only proceed if flash region is 1MB (0x12) or 2MB (0x20)
if **(RegionType == FLASH_REGION_SIZE_1MB **
Allocate and zero SMM communication buffer
CommBuffer = NULL;
Register "SFPFREC" SMI handler
RuntimeServices + 0x58 = SmiHandlerRegister
SmiHandlerRegister varargs call chain.
Call all registered init callbacks
Entry Point (ModuleEntryPoint)
Call library constructor to initialize service table pointers
UefiBootServicesTableLibConstructor (ImageHandle, SystemTable);
Call main SMM flash entry point
Status = SmiFlashEntryPoint (ImageHandle, SystemTable);
If entry point failed, clean up events
if (EFI_ERROR (Status)) {
SMI Handler Callbacks
RuntimeServices + 0x40 = SmiHandlerUnRegister
if (gRuntimeServicesUnreg != NULL) {

Generated by HR650X BIOS Decompilation Project