[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:
@@ -112,9 +112,7 @@ static void local_apic_callback(const void *_entry, size_t entry_len, void *cook
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: read the current APIC id and skip it, instead of assuming 0 is the boot cpu
|
||||
// read BSP from X86_IA32_APIC_BASE_MSR bit 8?
|
||||
if (entry->apic_id == 0) {
|
||||
if (entry->apic_id == x86_get_apic_id()) {
|
||||
// skip the boot cpu
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user