diff options
author | Ian Moffett <ian@osmora.org> | 2024-04-30 20:41:44 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2024-04-30 20:41:44 -0400 |
commit | 130ef7a34df14a57097a273867bc2bb5816d5f49 (patch) | |
tree | e4e33b29b2e713e794ed1caefcc0af13d3a6000a /sys/arch/amd64 | |
parent | 1586c50040f6d40630a0c9215575190103c4270f (diff) |
kernel/amd64: machdep: Add cpu_halt_others()
Halts all other processors except self
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/arch/amd64')
-rw-r--r-- | sys/arch/amd64/amd64/machdep.c | 15 |
1 files changed, 15 insertions, 0 deletions
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 <machine/cpu.h> #include <machine/uart.h> #include <machine/cpuid.h> +#include <machine/sysvec.h> #include <dev/pci/pci.h> #include <vm/vm.h> #include <vm/dynalloc.h> @@ -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) { |