# CapsuleX64
**Index:** 0405 | **Size:** 23,328 bytes | **Phase:** PEI | **Format:** PE32+ (x64)

## Overview
X64-specific capsule processing PEIM that handles capsule integrity validation, descriptor relocation, and data coalescing during the PEI phase. Implements a page fault handler for on-demand page table allocation, X64 exception handling with full CPU context dumps, APIC identification, PE/COFF image lookup, and debug output via serial port.

## Key Functions
- **PageFaultHandler** -- On-demand page table allocator for long-mode paging
- **ExceptionHandler** -- X64 exception handler with CRx/DRx/MSR register dump
- **ValidateCapsuleIntegrity** -- Capsule integrity verification across scatter-gather descriptors
- **RelocateCapsuleDescriptors** -- Relocates capsule descriptors from temporary RAM to permanent memory
- **CapsuleCoalesce** -- Coalesces fragmented capsule data into a contiguous buffer
- **DebugSerialPrint** -- Debug output via serial port
- **ApicId** -- Local APIC ID retrieval
- **PeCoffLookup** -- PE/COFF image entry point and relocation lookup
- **PageTableSetup** -- Page table manipulation for capsule address space

## Dependencies
- EFI_PEI_CAPSULLE_PPI -- Capsule services PPI
- EFI_PEI_SERVICES -- PEI service table
- X64 page tables (long-mode paging)
- Serial port for debug output

## Platform
Intel Purley (Skylake-SP Xeon), HR650X
Source: MdeModulePkg/Universal/CapsulePei/X64/