# EarlyVideoPei

EarlyVideoPei is a PEI-phase video initialization module recovered from the
AMI UEFI BIOS image.  The source set is decompiled and intentionally keeps IDA
types, calling-convention annotations, register comments, and raw hardware
access expressions visible for analysis.

## Module Facts

| Field | Value |
|---|---|
| Index | 420 |
| Module | EarlyVideoPei |
| Phase | PEI |
| Architecture | IA32 (x86, PE32) |
| Subsystem | EFI Boot Service Driver (0x000B) |
| Machine | 0x014C (i386) |
| Entry Point | 0x320 |
| Image Size | 95,652 bytes |
| Sections | .text: 45,246 / .rdata: 1,404 / .data: 48,033 / .reloc: 320 |
| Functions | 179 entries in `EarlyVideoPei_function_list.csv` |

## Layout

- `EarlyVideoPei.c` is the compact aggregate decompilation for the first
  recovered functions.
- `*.c` split files hold one function per file and are the easiest place to
  review individual routines.
- `EarlyVideoPei_function_list.csv` records address, size, basic-block, caller,
  callee, string, and constant counts.
- `EarlyVideoPei.md` groups the recovered functions by subsystem for browsing.
- `EarlyVideoPei.h` contains the minimal module header used by this source set.

## Functional Areas

- Entry and PEI service helpers: `ModuleEntryPoint`, `PeiGetPeiServices`,
  `PeiLocatePpi`, `PeiAllocatePool`, `PeiGetBootMode`, `PeiAssert`.
- Memory helpers: `InternalCopyMem`, `CopyMem`, `InternalSetMem`, `SetMem`,
  `SetMem16`, `SetMem32`, `ZeroMem`, `InitMultiple`.
- PCI and MMIO helpers: `PciCfg*`, `PciReg*`, `MmioCfgRead`, `MmioCfgWrite`,
  `MicroSecondDelay`.
- VGA register programming: `VgaSeq*`, `VgaCrtc*`, `VgaGc*`, `VgaAttr*`,
  `VgaDisplay*`, `VgaMode*`.
- Image and logo handling: `ImageDecode*`, `Bitmap*`, `ImageRender*`,
  `ImageXorDecodeType*`, `LogoDecode`, `LogoRender*`, `LogoDisplayMain`.
- Debug display support: `DebugVgaPrint`, `DebugAssertPrint*`,
  `DebugPrintAll`, `DebugPrintEntry`, `DebugHexPrint`, `DebugVgaPrintStr`.

## Reading Notes

This is analysis-oriented source, not normalized firmware source.  Keep the
generated names and raw expressions intact unless there is independent evidence
for a semantic rename.  Prefer presentation-only cleanup: spacing, local
comments, function grouping, and cross-reference notes.
