[arch][x86] handle the local apic of the boot cpu not being 0

I have a bulldozer machine here that curiously starts the APIC IDs for
the cpus at 16 and counts up.

This is a problem since the current code assumes that the boot cpu is 0,
and would try to start itself (apic id 16) later because it thought it
was the first secondary. Fix this by re-reading the APIC id on the boot
cpu and patching the percpu structure a bit into boot. Kinda a hack but
avoids having to detect the APIC, find the type of ID to read, etc.

Also means that practically speaking the system is using the full 32bit
APIC IDs if that feature is present, since now the local apic id is
entirely read from the local apic as it should be (if present).

Fixes #475
This commit is contained in:
Travis Geiselbrecht
2025-09-22 20:57:30 -07:00
parent bdf2203fdc
commit b7d69d8804
5 changed files with 19 additions and 20 deletions

View File

@@ -85,8 +85,6 @@ status_t arch_mp_send_ipi(mp_cpu_mask_t target, mp_ipi_t ipi) {
return NO_ERROR;
}
void arch_mp_init_percpu(void) {}
void x86_secondary_entry(uint cpu_num) {
// Read the local apic id from the local apic.
// NOTE: assumes a local apic is present but since this is a secondary cpu,