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

EnglishDxe

Function Table

Address Name Description
ModuleEntryPoint
UnicodeCollationEngEntryPoint
EngStriUpper
EngStriLower
EngStriColl
EngStrToFat
EngMetaiMatch
DebugAssert
DebugPrint
ReadUnaligned64
IsProtocolInstalled
Global Data
UINT8 byte_10A0[512] = {0};
UINT8 byte_12A0[256] = {0};
FAT directory ordering priority table (0x1398, 256 bytes).
Stores sort priorities for ASCII characters.
UINT8 byte_1398[256] = {0};
Cached debug output device protocol pointer (0x1088).
UINT64 qword_1088 = 0;
Cached HOB list pointer (0x1090).
UINT64 qword_1090 = 0;
UEFI ImageHandle stored by the EDK2 UefiBootServicesTableLib constructor.
EFI_HANDLE gImageHandle = NULL;
UEFI SystemTable stored by the EDK2 UefiBootServicesTableLib constructor.
EFI_SYSTEM_TABLE *gST = NULL;
UEFI BootServices pointer, extracted from SystemTable.
EFI_BOOT_SERVICES *gBS = NULL;
UEFI RuntimeServices pointer, extracted from SystemTable.
EFI_RUNTIME_SERVICES *gRT = NULL;
Function Implementations
UEFI driver entry point. Called by firmware after image loading.
Saves the ImageHandle and SystemTable in global variables, extracts
BootServices and RuntimeServices pointers, validates them, then
initializes the HOB library and calls the Unicode Collation driver
entry point.
EFI_STATUS EFIAPI
Unicode Collation driver entry point.
Initializes the three case-conversion and classification tables
installs EFI_UNICODE_COLLATION_PROTOCOL on a new handle.
Table initialization:
flag bit (bit 0 of byte_10A0[c + 256]) set.
Initialize the case conversion and classification tables
for (Index = 0; Index < 256; Index++) {
Sort priority: default to distance from 'A' + 1
Set upper-case mapping for lowercase letters (a-z -> A-Z)
and set FAT-legal flags
if **((Index + 151 <= 0x19) // Index in [97, 122] (0x61-0x7a)**
Index in [?, ?]
Index in [0, 6]
Set legal FAT char flag
Sort priority
Alternate mapping
Mark the legal FAT file name characters
Char = '0';
Install the Unicode Collation protocol
NULL // );
Status = gBS->InstallMultipleProtocolInterfaces(
Handle &gEfiUnicodeCollationProtocolGuid, // GUID
Interface &gEfiUnicodeCollation2ProtocolGuid, // GUID2
Interface2 NULL
Convert a string to upper case using the byte_10A0[] translation table.
For each character in the string, if the character is < 0x100, its
otherwise the last non-zero character processed.
Convert a string to lower case using the byte_12A0[] translation table.
Pattern syntax:
All character comparisons are case-insensitive, using the lower-case
Handle '*' match zero or more characters
if (PatternChar == L'*') {
Handle '?' match any single character
if (PatternChar == L'?') {
Handle '[' character range
if (PatternChar == L'[') {
StringChar as integer
Handle range '-'
if (CurrentPatternChar == L'-') {
Empty bracket no match
return FALSE;
Literal character comparison (case-insensitive)
StringChar = (S1 > 0xFF) ? S1 : byte_12A0[*S1];
Converts an ASCII string to a FAT-format Unicode string.
This simply copies bytes from the 8-bit ASCII input and zero-extends
each to a 16-bit CHAR16 output value.
Converts a Unicode string to a FAT file name (8.3 format).
1 if any replacement with '_' was necessary.
Skip dots and spaces
if (Char != L'.' && Char != L' ') {
If it's a legal FAT character (bit 0 set in classification table)
if (Char < 0x100 && (byte_10A0[Char + 256] & 1) != 0) {
Retrieves the debug output device protocol.
Allocates an event and then uses gBS->LocateProtocol() to find the
debug output device via the HOB list GUID. If the allocation succeeds
but the protocol is not found, the cached pointer is set to NULL.
Results are cached in qword_1088 after the first successful lookup.
VOID *
Allocate pool (BootServices + 24 = AllocatePool with type=31=EfiBootServicesData)
PoolSize = (UINTN)gBS->AllocatePool(31, 0, &Interface);
Locate protocol via HOB list GUID
Status = gBS->LocateProtocol(
Protocol GUID
Registration &qword_1088 // Interface
Debug assertion handler.
Reads the CMOS diagnostic output device configuration (CMOS index 0x4B)
to determine where to send assertion output. If the device supports
the error level indicated by FileName (upper bits), calls the assertion
handler on the debug output device.
The CMOS byte at 0x4B encodes the platform type:
1 = platform with serial debug output
2 = platform with video/console debug output
Read CMOS diagnostic port to determine platform type
PlatformType *= ((volatile UINT8 *)0xFDAF0490 & 2) 1;**
EFI_ERROR_MASK ** bit 1 (platform type >=2)**
EFI_ERROR_MASK only (platform type 1)
Check if the error level matches what this device handles
if ((ErrorMask & (UINTN)FileName) != 0) {
Call the debug device's assertion handler (offset +0 = ASSERT)
Debug print function.
Formats and sends a debug message through the debug output device.
The first argument encodes the error level; the second is the format
Call debug device's print handler (offset +8 = PRINT)
Locates the HOB (Hand-Off Block) list from the UEFI System Table
configuration table.
Scans SystemTable->ConfigurationTable[] entries looking for the GUID
which is EFI_HOB_LIST_GUID.
Results are cached in qword_1090 after the first successful lookup.
Not found in configuration table
Reads an unaligned 64-bit value from memory.
Implements the EDK2 BaseLib ReadUnaligned64() function. If the Buffer
pointer is NULL, issues a debug assertion via DebugPrint().
Checks whether a configuration table entry matches a reference GUID.
Compares the VendorGuid field of an EFI_CONFIGURATION_TABLE entry
against the EFI_HOB_LIST_GUID by reading both as unaligned 64-bit
Compare first 8 bytes and second 8 bytes as 64-bit values
return (ReadUnaligned64((CONST UINT64 *)&ReferenceGuid) ==

Generated by HR650X BIOS Decompilation Project