The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
smp.c File Reference

start the other cores at boot (smp_init in cpu.h). More...

Functions

void smp_init (void)
 start the other cores that the ACPI MADT gives, one at a time.
void cpu_ap_main (cpu_t *cpu, bool has_timer)
 the rest of the start of a core other than the boot core, after the arch code has set up its registers, tables and local APIC.

Detailed Description

start the other cores at boot (smp_init in cpu.h).

the boot core starts the cores in the order of the ACPI MADT, one at a time. each core gets its cpu_t and a stack, and the arch code starts it (arch_cpu_start). a core that does not answer is left out, and the cores after it are not started. each core then runs processes from its own run queue (scheduler.c).

Function Documentation

◆ smp_init()

void smp_init ( void )

start the other cores that the ACPI MADT gives, one at a time.

the kernel command line can limit them: "nosmp" keeps only the boot core, "maxcpus=N" starts at most N cores, the boot core included. call it on the boot core with interrupts on, after apic_init.

◆ cpu_ap_main()

void cpu_ap_main ( cpu_t * cpu,
bool has_timer )

the rest of the start of a core other than the boot core, after the arch code has set up its registers, tables and local APIC.

it marks the core online and becomes the idle task of the core, which runs processes from the run queue of the core.

Parameters
cputhe cpu_t of the core that runs the call.
has_timertrue if the core has a timer. without one the scheduler cannot end a time slice on the core, so the core only halts and runs no processes.