summaryrefslogtreecommitdiff
path: root/src/sys/include
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-09-15 14:57:21 -0400
committerIan Moffett <ian@osmora.org>2025-09-15 14:57:21 -0400
commit0d6c636c0ef3bcdc3285afb914cf28326b1b84ff (patch)
tree3ea5ba61c4fc919b1fcc8d90ba52b75d0110c0c0 /src/sys/include
parent44e8b43d4a468129e62ff11f41e70c109336f4d7 (diff)
kern/amd64: lapic: Add LAPIC timer support
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'src/sys/include')
-rw-r--r--src/sys/include/arch/amd64/lapic.h15
-rw-r--r--src/sys/include/arch/amd64/mdcpu.h2
2 files changed, 17 insertions, 0 deletions
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_ */