# RuntimeSmm

**Index:** 0204
**Size:** 5,476 bytes (1564h)
**Phase:** SMM (DXE_SMM_DRIVER)
**Source Package:** AmiModulePkg\RuntimeSmm\RuntimeSmm.c

## Overview
Minimal UEFI SMM runtime driver that bridges boot-time and SMM runtime services. Initializes global pointers to Boot Services, Runtime Services, and System Table; locates the SmmBase2 protocol to obtain the SMM Services Table (gSmst); registers a protocol notification handler for the SMM Runtime Services Table protocol. Uses SetJump/LongJump for error recovery. Has no import table -- all protocol interfaces resolved via LocateProtocol.

## Key Functions
- **sub_44C** -- Initializes gImageHandle, gST, gBS, gRT, locates SmmBase2, retrieves gSmst
- **sub_58C** -- Main dispatch: SetJump error recovery, calls sub_768 init, cleans up with LongJump
- **sub_768** -- Driver init: caches system tables, locates SMM Runtime Services Table protocol, calls its callback, installs protocol handlers
- **sub_300 / sub_3A0** -- SetJump/LongJump: saves/restores GP registers, XMM registers, MXCSR into 248-byte buffer
- **sub_64C** -- Allocates buffer with protocol GUID data, registers via SmmRegisterProtocolNotify
- **sub_9F8 / sub_A80** -- Protocol registration for Runtime Services and Status Code in both SMM and boot modes

## Protocols
- SmmBase2 protocol (SMM_SERVICES_TABLE_GUID)
- SMM Runtime Services Table protocol
- gEfiStatusCodeRuntimeProtocolGuid (DebugLib)

## Platform
HR650X (Purley), built from PurleyPlatformPkg/AmiModulePkg, DEBUG VS2015 X64
