From 0d6c636c0ef3bcdc3285afb914cf28326b1b84ff Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Mon, 15 Sep 2025 14:57:21 -0400 Subject: kern/amd64: lapic: Add LAPIC timer support Signed-off-by: Ian Moffett --- src/sys/include/arch/amd64/lapic.h | 15 +++++++++++++++ src/sys/include/arch/amd64/mdcpu.h | 2 ++ 2 files changed, 17 insertions(+) (limited to 'src/sys/include/arch/amd64') diff --git a/src/sys/include/arch/amd64/lapic.h b/src/sys/include/arch/amd64/lapic.h index d73e7d0..3cb2f3a 100644 --- a/src/sys/include/arch/amd64/lapic.h +++ b/src/sys/include/arch/amd64/lapic.h @@ -31,10 +31,25 @@ #ifndef _MACHINE_LAPIC_H_ #define _MACHINE_LAPIC_H_ 1 +#define LAPIC_TIMER_VEC 0x81 + /* * Initialize the local APIC on the current * processor. */ void lapic_init(void); +/* + * Send an end-of-interrupt message to the current + * processor's Local APIC + */ +void lapic_eoi(void); + +/* + * Start Local APIC timer oneshot in microseconds. + * + * @us: Microseconds. + */ +void lapic_timer_oneshot_us(size_t usec); + #endif /* !_MACHINE_LAPIC_H_ */ diff --git a/src/sys/include/arch/amd64/mdcpu.h b/src/sys/include/arch/amd64/mdcpu.h index 1503adb..3fccc42 100644 --- a/src/sys/include/arch/amd64/mdcpu.h +++ b/src/sys/include/arch/amd64/mdcpu.h @@ -48,6 +48,7 @@ * @lapic_base: LAPIC register interface base * @x2apic: Has the x2APIC? Is 1 if true * @tss: Task state segment for this core + * @lapic_tmr_freq: Local APIC timer frequency */ struct mdcore { uint32_t apic_id; @@ -55,6 +56,7 @@ struct mdcore { void *lapic_base; uint8_t x2apic : 1; struct tss_entry tss; + size_t lapic_tmr_freq; }; #endif /* !_MACHINE_MDCPU_H_ */ -- cgit v1.2.3