# CPUInfo

## Function Table

| Address | Name | Description |
|---------|------|-------------|
|  | **CpuInfoEntryPoint** |  |
|  | **GetPeiServices** |  |
|  | **VgaPrintStringAt** |  |
|  | **AsmCpuid** |  |
|  | **CpuId** |  |
|  | **AsciiStrLen** |  |
|  | **ReadIdtr** |  |
|  | **CpuInfoReportAssertion** |  |
|  | **CpuDeadLoop** |  |
| EFI_STATUS | **codes used in GetCpuPresenceStatus** |  |
| approximate | **#define CPU_NOT_PRESENT     0** |  |
| VGA | **constants** |  |
| Progress | **display table entry:  { x, y }** |  |
| Terminated | **with x == 0xFF / -1** |  |
| Forward | **declarations** |  |
| EFI_STATUS | **EFIAPI** |  |
| Helper | **function prototypes** |  |
| EFI_STATUS | **GetPeiServices (** |  |
| Module | **Entry Point** |  |
| Display | **initial POST progress: 0%** |  |
| VgaPrintStringAt | **(0, 9, "== Progress :   0% ==");** |  |
| Iterate | **the progress-position table and display** |  |
| at | **each position until terminator (-1) is found.** |  |
| The | **table is an array of PROGRESS_POSITION {X,Y}** |  |
| entries | **at byte_FFE83F24.** |  |
| ProgressTable | **= (PROGRESS_POSITION*)(UINTN)0xFFE83F24;** |  |
| Skip | **entry (50,y) when y is in [11..21] — these are** |  |
| the | **"already displayed" slots.** |  |
| if | **(X != 50 || Y < 11 || Y > 21) {** |  |
| Install | **PPI or propagate descriptor to next PEIM** |  |
| table | **at offset +36 (sizeof(EFI_PEI_SERVICES) + 36)** |  |
| with | **unk_FFE83F14 as the parameter. This could be** |  |
| In | **the PEIM case, this likely dispatches a notification** |  |
| or | **installs a PPI.** |  |
| return | **EFI_SUCCESS;** |  |
| VGA | **Print Support** |  |
| Calculate | **VGA buffer offset: 2 bytes per cell** |  |
| VGA | **memory starts at 0xB8000 (753664 in decimal)** |  |
| VgaPtr | **= VGA_TEXT_MEMORY + (X + Y * 80);** |  |
| Hide | **cursor by setting cursor position to scanline 32** |  |
| IoWrite8 | **(VGA_CRTC_ADDR_PORT, VGA_CURSOR_START);** |  |
| Write | **string characters with attribute 7** |  |
| for | **(Index = 0; Index < Length; Index++) {** |  |
| Set | **attribute of the last character (foreground)** |  |
| CPU | **Presence Detection** |  |
| Read | **current RTC address register, preserve NMI mask (bit 7)** |  |
| select | **CMOS index 0x4A (CPU presence)** |  |
| OriginalReg | **= IoRead8 (RTC_ADDRESS_PORT);** |  |
| Read | **CPU presence value from CMOS data register** |  |
| CmosValue | **= IoRead8 (RTC_DATA_PORT);** |  |
| Interpret | **the value:** |  |
| if | **(CmosValue > 3) {** |  |
| Read | **GPIO/MMIO register at fixed address for CPU presence** |  |
| bit | **1 set = CPU present** |  |
| CmosValue | **= (*(volatile UINT8*)0xFDAF0490 & 2) | 1;** |  |
| No | **CPU** |  |
| 0xFF | **means not valid/empty** |  |
| if | **(CmosValue == 0xFF) {** |  |
| Empty | **socket** |  |
| 0xFFFFFFFF | **}** |  |
| 0x80000000 | **(-2147483648)** |  |
| PEI | **Services Access** |  |
| The | **PEI Services pointer is stored at the DWORD immediately** |  |
| before | **the IDT base address.** |  |
| PeiServices | **= *(UINTN*)(*(UINTN*)&Idtr.Base - sizeof (UINTN));** |  |
| Call | **PEI Service at offset 32 (likely LocatePpi or similar)** |  |
| looking | **for the GUID at unk_FFE83EF4.** |  |
| if | **((*PeiServices)->LocatePpi (** |  |
| Debug | **Print (Conditional)** |  |
| Call | **PEI Services debug print at offset 0** |  |
| This | **is typically DebugPrint or similar.** |  |
| return | **(*(PeiServices + 0))(ErrorLevel, Format, (CHAR8*)Va);** |  |
| CPUID | **Wrappers** |  |
| Check | **if leaf 0x0B is supported (EBX non-zero means valid)** |  |
| if | **(a1 != NULL) {** |  |
| ASSERT | **/ Debug Assert Support** |  |
| PEI_SERVICES | **+ 4 is ReportStatusCode or assertion handler** |  |
| String | **Helpers** |  |
| IDTR | **Access** |  |
| Memory | **Functions** |  |
| Check | **for backwards overlap: if src < dst and src+count-1 >= dst** |  |
| copy | **from end to start.** |  |
| if | **((UINTN)Src8 < (UINTN)Dst8 && ((UINTN)Src8 + Count - 1) >= (UINTN)Dst8) {** |  |
| Src8 | **= &Src8[Count - 1];** |  |
| for | **(; Count >= 4; Count -= 4) {** |  |

---
*Generated by HR650X BIOS Decompilation Project*