# RuntimeDxe

## Function Table

| Address | Name | Description |
|---------|------|-------------|
|  | **ModuleEntryPoint** |  |
|  | **UefiBootServicesTableLibConstructor** |  |
|  | **RuntimeDriverInitialize** |  |
|  | **RuntimeDriverConvertPointer** |  |
|  | **RuntimeDriverSetVirtualAddressMap** |  |
|  | **RuntimeDriverCalculateCrc32** |  |
|  | **RuntimeDriverDebugProtocol** |  |
|  | **DebugPrint** |  |
|  | **DebugAssert** |  |
|  | **VirtualAddressChangeNotify** |  |
|  | **RuntimeDriverExitBootServicesNotify** |  |
|  | **RuntimeDriverInitializeEndOfDxe** |  |
|  | **RuntimeDriverInitializeEndOfDxeCallback** |  |
|  | **RuntimeDriverPeCoffRelocateImage** |  |
|  | **ReportStatusCodeConstructor** |  |
|  | **RuntimeDriverSetVirtualAddressMapHandler** |  |
|  | **RuntimeDriverSetVirtualAddressMapNotify** |  |
|  | **RuntimeDriverCalculateCrc32Event** |  |
|  | **RuntimeDriverCompareGuid** |  |
|  | **RuntimeDriverReadUnaligned64** |  |
|  | **RuntimeDriverSetWatchdogTimerHandler** |  |
| Events | **registered during initialization** |  |
| EFI_EVENT | **mRuntimeDriverExitBootServicesEvent   = NULL;** |  |
| Status | **code protocol table pointer** |  |
| VOID | ***mRuntimeStatusCodeTable = NULL;** |  |
| Set | **TRUE after SetVirtualAddressMap has been called** |  |
| BOOLEAN | **mEfiGoneVirtual = FALSE;** |  |
| Linked | **list head for registered images** |  |
| LIST_ENTRY | **mRuntimeDriverImageList;** |  |
| Initialize | **UEFI boot/runtime service table pointers** |  |
| UefiBootServicesTableLibConstructor | **(ImageHandle, SystemTable);** |  |
| Perform | **runtime driver initialization** |  |
| Status | **= RuntimeDriverInitialize (ImageHandle);** |  |
| Register | **VirtualAddressChange notification (TPL_CALLBACK, notify function)** |  |
| Status | **= BootServices->CreateEvent (** |  |
| Register | **event to disable watchdog timer on ExitBootServices** |  |
| Register | **EndOfDxe notification** |  |
| Status | **= gBootServices->CreateEvent (** |  |
| Register | **SetVirtualAddressMap notification** |  |
| Initialize | **the status code reporting interface** |  |
| ReportStatusCodeConstructor | **();** |  |
| Register | **ExitBootServices notification via status code protocol** |  |
| Register | **SetVirtualAddressMap notification via status code protocol** |  |
| Locate | **the Runtime Image protocol** |  |
| Status | **= gBootServices->LocateProtocol (** |  |
| Hook | **the SetWatchdogTimer runtime service** |  |
| Install | **the Runtime Driver protocol** |  |
| Walk | **the virtual address map to find the descriptor covering** |  |
| the | **input address** |  |
| Descriptor | **= (EFI_MEMORY_DESCRIPTOR *)mRuntimeDriverImageList.ForwardLink;** |  |
| Apply | **the virtual address offset** |  |
| Flush | **data and instruction caches for the memory map** |  |
| RuntimeDriverCalculateCrc32 | **((VOID *)(UINTN)MemoryMapSize, 51449860);** |  |
| Notify | **all registered virtual address change callbacks** |  |
| ImageEntry | **= mRuntimeDriverImageList.ForwardLink;** |  |
| Convert | **the callback address** |  |
| Index | **= (UINTN)ImageEntry->PhysicalStart;** |  |
| Invoke | **the callback (OriginalImageBase, SizeOfImage, ImageEntry)** |  |
| Walk | **the image list and convert each image's base address** |  |
| for | **(ImageEntry = mRuntimeDriverImageList.ForwardLink;** |  |
| Flush | **instruction cache** |  |
| if | **(ImageEntry->ImageSize != NULL &&** |  |
| Convert | **all Runtime Services pointers** |  |
| RuntimeDriverConvertPointer | **(0, (VOID **)&gRuntime->GetTime);** |  |
| Recalculate | **CRC32 for Runtime Services table** |  |
| Crc32Out | **= 0;** |  |
| Recalculate | **CRC32 for System Table** |  |
| Notify | **POST card of successful virtual address switch** |  |
| IoWrite8 | **(0x80, 0xB1);** |  |
| Check | **for overflow** |  |
| if | **(DataSize > (MAX_ADDRESS - (UINTN)Data + 1)) {** |  |
| Check | **if this is boot-time and allocate protocol** |  |
| if | **(gBootServices != NULL &&** |  |
| Check | **if the debug protocol is available** |  |
| if | **(mRuntimeStatusCodeTable != NULL) {** |  |
| Read | **the current debug level from CMOS** |  |
| DebugLevel | **= IoRead8 (0x70);** |  |
| Check | **if HOB list is already cached** |  |
| if | **(mRuntimeDriverBootServicesEvent == NULL) {** |  |
| Walk | **configuration table entries looking for HobList** |  |
| for | **(Index = 0; Index < (UINTN)gSystemTable->NumberOfTableEntries; Index++) {** |  |
| Check | **for DOS header magic** |  |
| if | **(*(UINT16 *)OldBase == IMAGE_DOS_SIGNATURE) {** |  |
| e_lfanew | **} else {** |  |
| Check | **for PE signature** |  |
| if | **(*(UINT32 *)ImageBase != IMAGE_PE_SIGNATURE) {** |  |
| Determine | **relocation directory RVA and size** |  |
| if | **(*(UINT16 *)(ImageBase + 4) == 0x200 &&** |  |
| RelocDirEntryRva | **= *(UINT32 *)(ImageBase + 0x84);** |  |
| PE32 | **(32-bit)** |  |
| RelocDirEntryRva | **= *(UINT32 *)(ImageBase + 0x74);** |  |
| Validate | **relocation directory size** |  |
| if | **(RelocDirEntrySize <= sizeof(UINT32) * 2) {** |  |
| Calculate | **relocation base and end pointers** |  |
| RelocBase | **= OldBase + RelocDirEntryRva;** |  |
| Walk | **each base relocation block** |  |
| RelocHdr | **= (UINT32 *)RelocBase;** |  |
| Intentionally | **empty (no-op)** |  |

---
*Generated by HR650X BIOS Decompilation Project*