Description
When activating additional CPUs they will start in real mode.
Trampoline assembly is used to initialize them, after issuing two IPI (inter processor interrupts) (INIT and START) via the APIC.
The start IPI sends the starting code segment for real mode, which is limited to the lower 1MB of memory.
The maximum physical memory address for real mode is FFFFF, which equates to segment F0, offset FFFF
Currently, the bootloader, in UEFI mode, will allocate pages starting near page 0, leaving no space left to place the IPI trampoline.
We could achieve this by allocating all pages below 1MB using UEFI allocate page function in a loop, and freeing them immediately preceding the call to exit boot services. This would ensure the UEFI loader does not allocate and reserve physical pages below 1MB.