|
ginnOS
The reference: libc, the libraries and the kernel
|
start the other cores at boot (smp_init in cpu.h). More...
#include "kernel/cpu/cpu.h"#include "arch/arch.h"#include "kernel/acpi/acpi.h"#include "kernel/cmdline.h"#include "kernel/klog/klog.h"#include "kernel/memory/pmm.h"#include "kernel/process/process.h"#include "kernel/scheduler/scheduler.h"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. | |
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).
| 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.
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.
| cpu | the cpu_t of the core that runs the call. |
| has_timer | true 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. |