StuBS
Loading...
Searching...
No Matches
startup_ap.h File Reference

Startup of additional cores, the application processors (APs) More...

#include "types.h"
#include "compiler/fix.h"
Include dependency graph for startup_ap.h:

Namespaces

namespace  ApplicationProcessor
 Application Processor Boot.
 

Functions

void ApplicationProcessor::relocateSetupCode ()
 Relocate the real mode setup code.
 
void ApplicationProcessor::boot ()
 Boot all application processors.
 
void setup_ap () ERROR_ON_CALL("The setup function for application processors shall never be called from your code!")
 Entry point for application processors.
 
void startup_ap () ERROR_ON_CALL("The startup function for application processors shall never be called from your code!")
 Startup for application processors.
 

Variables

const uintptr_t ApplicationProcessor::RELOCATED_SETUP = 0x40000
 Address (below 1 MiB) to which the setup code gets relocated.
 
char ___SETUP_AP_START__
 Begin of setup code for application processors.
 
char ___SETUP_AP_END__
 End of startup code for application processors.
 
char setup_ap_gdt
 Memory reserved for a temporary real mode GDT within the relocatable memory area of the setup code.
 
char setup_ap_gdtd
 Memory reserved for a temporary real mode GDT descriptor within the relocatable memory area of the setup code.
 

Detailed Description

Startup of additional cores, the application processors (APs)

Function Documentation

◆ setup_ap()

void setup_ap ( )

Entry point for application processors.

Unlike the bootstrap processor, the application processors have not been setup by the boot loader – they start in Real Mode (16 bit) and have to be switched manually to Protected Mode (32 bit). This is exactly what this real mode function does, handing over control to the (32 bit) function startup_ap()

This code is written is assembly (boot/startup_ap.asm) and relocated by ApplicationProcessor::relocateSetupCode() during ApplicationProcessor::boot()

◆ startup_ap()

void startup_ap ( )

Startup for application processors.

This function behaves similar to startup_bsp(): Initializes stack pointer, and calls the C++ kernel_init function

Variable Documentation

◆ ___SETUP_AP_END__

char ___SETUP_AP_END__
extern

End of startup code for application processors.

This Symbol is defined in the linker script (compiler/section.ld)

◆ ___SETUP_AP_START__

char ___SETUP_AP_START__
extern

Begin of setup code for application processors.

The setup code has to switch from real mode (16 bit) to protected mode (32 bit), hence it is written in assembly and must be executed in low memory (< 1 MiB).

After kernel start the code is somewhere above 16 MiB (the bootstrap processor was already launched in protected mode by the boot loader). Therefore this symbol is required for relocate the code to the position specified by ApplicationProcessor::RELOCATED_SETUP.

Luckily, the setup_ap code in boot/startup_ap.asm is rather simple and doesn't depend on absolute addressing – and is therefore relocatable.

Relocation is done by the function ApplicationProcessor::relocateSetupCode()

The ___SETUP_AP_START__ symbol is defined in the linker script (compiler/section.ld)