diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/aarch64/aarch64/machdep.c | 7 | ||||
-rw-r--r-- | sys/arch/amd64/amd64/machdep.c | 15 | ||||
-rw-r--r-- | sys/include/arch/aarch64/cpu.h | 2 | ||||
-rw-r--r-- | sys/include/arch/amd64/cpu.h | 1 | ||||
-rw-r--r-- | sys/kern/kern_panic.c | 8 |
5 files changed, 32 insertions, 1 deletions
diff --git a/sys/arch/aarch64/aarch64/machdep.c b/sys/arch/aarch64/aarch64/machdep.c index a29ad7e..7c21e62 100644 --- a/sys/arch/aarch64/aarch64/machdep.c +++ b/sys/arch/aarch64/aarch64/machdep.c @@ -42,6 +42,13 @@ cpu_startup(struct cpu_info *ci) } void +cpu_halt_others(void) +{ + /* TODO: STUB */ + return; +} + +void serial_init(void) { /* TODO: STUB */ diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c index 07d6cdd..4a885fa 100644 --- a/sys/arch/amd64/amd64/machdep.c +++ b/sys/arch/amd64/amd64/machdep.c @@ -174,6 +174,21 @@ cpu_halt_all(void) for (;;); } +/* + * Same as cpu_halt_all() but for all other + * cores but ourselves. + */ +void +cpu_halt_others(void) +{ + if (rdmsr(IA32_GS_BASE) == 0) { + __ASMV("cli; hlt"); + } + + /* Send IPI to all cores */ + lapic_send_ipi(0, IPI_SHORTHAND_OTHERS, halt_vector); +} + void serial_init(void) { diff --git a/sys/include/arch/aarch64/cpu.h b/sys/include/arch/aarch64/cpu.h index a6ccdec..2f62d95 100644 --- a/sys/include/arch/aarch64/cpu.h +++ b/sys/include/arch/aarch64/cpu.h @@ -40,6 +40,8 @@ struct cpu_info { }; void cpu_startup(struct cpu_info *ci); +void cpu_halt_others(void); + void mp_bootstrap_aps(struct cpu_info *ci); struct cpu_info *this_cpu(void); diff --git a/sys/include/arch/amd64/cpu.h b/sys/include/arch/amd64/cpu.h index ce42416..dd753b7 100644 --- a/sys/include/arch/amd64/cpu.h +++ b/sys/include/arch/amd64/cpu.h @@ -49,6 +49,7 @@ struct cpu_info { }; __dead void cpu_halt_all(void); +void cpu_halt_others(void); void cpu_startup(struct cpu_info *ci); struct cpu_info *this_cpu(void); diff --git a/sys/kern/kern_panic.c b/sys/kern/kern_panic.c index 950ea8f..7660fff 100644 --- a/sys/kern/kern_panic.c +++ b/sys/kern/kern_panic.c @@ -31,6 +31,8 @@ #include <sys/spinlock.h> #include <sys/syslog.h> #include <sys/reboot.h> +#include <machine/cdefs.h> +#include <machine/cpu.h> /* * Burn and sizzle - the core logic that really ends @@ -69,8 +71,12 @@ panic(const char *fmt, ...) { va_list ap; + /* Shut everything else up */ + md_intoff(); + cpu_halt_others(); + va_start(ap, fmt); - kprintf(OMIT_TIMESTAMP "panic: "); + kprintf(OMIT_TIMESTAMP "\npanic: "); vkprintf(fmt, &ap); bas(true, REBOOT_HALT); |