From 32a88e354f6936ae0e2ab9c564293a09c6d77902 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Tue, 18 Nov 2025 16:04:19 -0500 Subject: kern/amd64: idt: Make idt.h includable in ASM This also moves the interrupt gate defines to the idt.h header so that they can be used within C code Signed-off-by: Ian Moffett --- sys/arch/amd64/cpu/idt.S | 4 +--- sys/inc/arch/amd64/idt.h | 7 +++++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/sys/arch/amd64/cpu/idt.S b/sys/arch/amd64/cpu/idt.S index b7169d8..c430a44 100644 --- a/sys/arch/amd64/cpu/idt.S +++ b/sys/arch/amd64/cpu/idt.S @@ -28,12 +28,10 @@ */ #include +#include #define KERNEL_CS 0x08 -#define INT_GATE 0x8E -#define TRAP_GATE 0x8F - .macro set_trap vector, isr movq \vector, %rdi movq $TRAP_GATE, %rsi diff --git a/sys/inc/arch/amd64/idt.h b/sys/inc/arch/amd64/idt.h index 69ca30a..1099310 100644 --- a/sys/inc/arch/amd64/idt.h +++ b/sys/inc/arch/amd64/idt.h @@ -30,11 +30,18 @@ #ifndef _MACHINE_IDT_H_ #define _MACHINE_IDT_H_ 1 +#define INT_GATE 0x8E +#define TRAP_GATE 0x8F + +#if !defined(__ASSEMBLER__) #include +#endif /* __ASSEMBLER__ */ +#if !defined(__ASSEMBLER__) /* * Set an interrupt gate */ void idt_set_gate(uint8_t vector, uint8_t type, uintptr_t isr, uint8_t ist); +#endif /* !__ASSEMBLER__ */ #endif /* !_MACHINE_IDT_H_ */ -- cgit v1.2.3