Function rstubs::arch::smp::relocate_setup

source ·
fn relocate_setup()
Expand description

Relocate the real mode setup code

The application processors (APs) start in real mode, which means that your setup code must be placed within the first megabyte – your operating system resides currently at a much higher address (1 MiB), so the code has to be copied down there first.

Luckily, the code in setup_ap can be relocated by copying – because it does not use any absolute addressing (except when jumping to the protected mode function start_high). The function must be copied to the address of RELOCATE_DST, so that the APs can start there.

§Note

You could also tell the linker script to put the code directly at the appropriate place, but unfortunately the Qemu multiboot implementation (via -kernel parameter) can’t handle it properly.