aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-05-14 19:12:43 -0400
committerIan Moffett <ian@osmora.org>2024-05-14 19:16:15 -0400
commite0ea82ad2ffd856da1c351a5ea7f4afd6d103d0e (patch)
tree08bcb6d5b7360f23dca44d733c081ae5e2cd1d0d /sys
parentdf8ff1d226a268f56206161c56eeb70321cb5d27 (diff)
kernel/amd64: Fix early panic triple fault
Check for a valid CPU structure and ensure the Local APIC base address has been set before trying to broadcast IPIs Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/amd64/amd64/machdep.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c
index 93bf664..a075532 100644
--- a/sys/arch/amd64/amd64/machdep.c
+++ b/sys/arch/amd64/amd64/machdep.c
@@ -253,7 +253,19 @@ machine_panic(void)
void
cpu_halt_others(void)
{
- lapic_send_ipi(0, IPI_SHORTHAND_OTHERS, SYSVEC_HLT);
+ struct cpu_info *ci = this_cpu();
+
+ /* Is the current CPU structure even valid? */
+ if (ci == NULL)
+ return;
+
+ /*
+ * If the Local APIC base address is NULL, we can't
+ * use lapic_send_ipi() but we we can assume the APs
+ * are still parked.
+ */
+ if (ci->lapic_base != NULL)
+ lapic_send_ipi(0, IPI_SHORTHAND_OTHERS, SYSVEC_HLT);
}
int