StuBS
Loading...
Searching...
No Matches
ApplicationProcessor Namespace Reference

Application Processor Boot. More...

Functions

void relocateSetupCode ()
 Relocate the real mode setup code.
 
void boot ()
 Boot all application processors.
 

Variables

constexpr GDT::SegmentDescriptor ap_gdt []
 Temporary Global Descriptor Table.
 
const uintptr_t RELOCATED_SETUP = 0x40000
 Address (below 1 MiB) to which the setup code gets relocated.
 

Detailed Description

Application Processor Boot.

Interface to boot the APs

Function Documentation

◆ boot()

void ApplicationProcessor::boot ( )

Boot all application processors.

Performs relocation by calling relocateSetupCode()

See also
ISDMv3, 8.4.4.2 Typical AP Initialization Sequence

◆ relocateSetupCode()

void ApplicationProcessor::relocateSetupCode ( )

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 (16 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 startup_ap()). The function must be copied to the address of RELOCATED_SETUP (0x40000), so that the APs can start there.

The memory section contains a reserved area for the GDT and its descriptor, which has to be assigned first with the contents of ap_gdt.

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.

Variable Documentation

◆ ap_gdt

constexpr GDT::SegmentDescriptor ApplicationProcessor::ap_gdt[]
constexpr
Initial value:
= {
{},
{ 0x0,
0xFFFFFFFF,
true,
0,
{ 0x0,
0xFFFFFFFF,
false,
0,
}
@ SIZE_32BIT
32-bit (D/B = 1, L = 0)
Definition gdt.h:48

Temporary Global Descriptor Table.

Blue print, to be copied into real mode code