# CpuIoPei

## Function Table

| Address | Name | Description |
|---------|------|-------------|
|  | **CmosCheckMode** |  |
|  | **GetPeiServicesTable** |  |
|  | **GetDebugInstance** |  |
|  | **CpuIoPeiEntryPoint** |  |
| Library | **helper: memset via compiler intrinsic** |  |
| void | ***__cdecl SetMem(void *buf, unsigned int count, char value)** |  |
| Library | **helper: memset32 via compiler intrinsic** |  |
| void | ***__cdecl SetMem32(void *buf, unsigned int count, int value)** |  |
| Library | **helper: memset32 for 2-dword fill pattern** |  |
| int | **__cdecl SetMem32Fill(int Buf, int Count, int Fill0, int Fill1)** |  |
| Library | **helper: memcpy with overlap handling** |  |
| char | ***__cdecl CopyMem(char *dst, char *src, unsigned int count)** |  |
| No | **overlap: copy dword-aligned first, then remainder** |  |
| __int64 | **__cdecl IoReadBufferFx(unsigned __int16 Port, unsigned int Count, unsigned __int8 *Buffer)** |  |
| __int64 | **__cdecl IoReadPortWordString(unsigned __int16 Port, unsigned int Count, unsigned __int16 *Buffer)** |  |
| __int64 | **__cdecl IoReadPortDwordString(unsigned __int16 Port, unsigned int Count, unsigned int *Buffer)** |  |
| __int64 | **__cdecl IoWriteBufferByte(unsigned __int16 Port, unsigned int Count, unsigned __int8 *Buffer)** |  |
| __int64 | **__cdecl IoWritePortWordString(unsigned __int16 Port, unsigned int Count, unsigned __int16 *Buffer)** |  |
| __int64 | **__cdecl IoWritePortDwordString(unsigned __int16 Port, unsigned int Count, unsigned int *Buffer)** |  |
| int | **__fastcall IoReadPortWord(unsigned __int16 Port)** |  |
| unsigned | **__int16 __fastcall IoWritePortWord(unsigned __int16 Port, unsigned __int16 Value)** |  |
| unsigned | **__int32 __fastcall IoReadPortDword(unsigned __int16 Port)** |  |
| unsigned | **int __fastcall IoWritePortDword(unsigned __int16 Port, unsigned int Value)** |  |
| MMIO | **Read - Word (aligned)** |  |
| int | **__fastcall IoReadMmioWord(unsigned __int16 *Address)** |  |
| MMIO | **Write - Word (aligned)** |  |
| __int16 | **__fastcall IoWriteMmioWord(_WORD *Address, __int16 Value)** |  |
| MMIO | **Read - Qword (aligned)** |  |
| __int64 | **__fastcall IoReadMmioQword(void *Address)** |  |
| MMIO | **Write - Qword (aligned)** |  |
| int | **__cdecl IoWriteMmioQword(void *Address, int Lo32, int Hi32)** |  |
| Unaligned | **Read - 16-bit** |  |
| __int16 | **__thiscall ReadUnaligned16(void *Buffer)** |  |
| Unaligned | **Write - 16-bit** |  |
| __int16 | **__fastcall WriteUnaligned16(_WORD *Buffer, __int16 Value)** |  |
| Unaligned | **Read - 32-bit** |  |
| int | **__thiscall ReadUnaligned32(void *Buffer)** |  |
| Unaligned | **Write - 32-bit** |  |
| int | **__fastcall WriteUnaligned32(_DWORD *Buffer, int Value)** |  |
| Unaligned | **Read - 64-bit** |  |
| __int64 | **__thiscall ReadUnaligned64(void *Buffer)** |  |
| Unaligned | **Write - 64-bit** |  |
| int | **__cdecl WriteUnaligned64(_DWORD *Buffer, int Lo32, int Hi32)** |  |
| __int64 | **__cdecl LShiftU64(__int64 Value)** |  |
| unsigned | **__int64 __cdecl RShiftU64(unsigned __int64 Value)** |  |
| CMOS | **Check Mode: determine debug printing capabilities** |  |
| Selects | **RTC register 0x4A to read the debug mode.** |  |
| Returns | **0 (no debug), negative error codes, or status.** |  |
| int | **CmosCheckMode()** |  |
| Get | **PEI Services Table Pointer** |  |
| Retrieves | **via IDT entry at offset -4 from IDT base.** |  |
| int | **GetPeiServicesTable()** |  |
| Read | **IDTR (SIDT instruction)** |  |
| void | ***__thiscall ReadIdtr(void *Idtr)** |  |
| Get | **Debug Instance from PEI Services** |  |
| Locates | **the gEfiPeiDebug2PpiGuid PPI.** |  |
| int | **GetDebugInstance()** |  |
| Debug | **Print (conditional on error level via CmosCheckMode)** |  |
| int | **__cdecl DebugPrint(int ErrorLevel, const char *Format, ...)** |  |
| Debug | **Assert (via debug instance)** |  |
| int | **__fastcall DebugAssert(** |  |
| CpuIoPei | **Entry Point** |  |
| Installs | **the CPU I/O PPI (EFI_PEI_CPU_IO_PPI) into the PEI database.** |  |
| On | **first invocation: installs via InstallPpi.** |  |
| On | **shadow (reload after memory): RegisterForShadow only.** |  |
| EFI_STATUS | **EFIAPI** |  |
| RegisterForShadow | **detects if this is first-time or reinstall** |  |
| First | **install: install the CPU I/O PPI descriptor** |  |

---
*Generated by HR650X BIOS Decompilation Project*