From 130ef7a34df14a57097a273867bc2bb5816d5f49 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Tue, 30 Apr 2024 20:41:44 -0400 Subject: kernel/amd64: machdep: Add cpu_halt_others() Halts all other processors except self Signed-off-by: Ian Moffett --- sys/arch/amd64/amd64/machdep.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'sys/arch/amd64') diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c index 809eb27..f73d773 100644 --- a/sys/arch/amd64/amd64/machdep.c +++ b/sys/arch/amd64/amd64/machdep.c @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -62,6 +63,13 @@ __KERNEL_META("$Hyra$: machdep.c, Ian Marco Moffett, " void syscall_isr(void); +__attr(interrupt) +static void +halt_isr(void *sf) +{ + processor_halt(); +} + static inline void init_tss(struct cpu_info *cur_cpu) { @@ -88,6 +96,7 @@ interrupts_init(void) idt_set_desc(0xD, IDT_TRAP_GATE_FLAGS, ISR(general_prot), 0); idt_set_desc(0xE, IDT_TRAP_GATE_FLAGS, ISR(page_fault), 0); idt_set_desc(0x80, IDT_INT_GATE_USER, ISR(syscall_isr), 0); + idt_set_desc(SYSVEC_HLT, IDT_INT_GATE_FLAGS, ISR(halt_isr), 0); idt_load(); } @@ -209,6 +218,12 @@ backtrace(void) } } +void +cpu_halt_others(void) +{ + lapic_send_ipi(0, IPI_SHORTHAND_OTHERS, SYSVEC_HLT); +} + int processor_init_pcb(struct proc *proc) { -- cgit v1.2.3