summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/cpu.c17
-rw-r--r--kernel/cpu.h1
2 files changed, 16 insertions, 2 deletions
diff --git a/kernel/cpu.c b/kernel/cpu.c
index b541513..3c7284c 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -116,6 +116,12 @@ static void set_idt(int vec,
}
}
+void set_ist(int vec, int ist_index)
+{
+ // non-destructively set the ist index.
+ idt[vec].access |= ist_index & 0x7;
+}
+
static void gdt_init(void)
{
set_gdt(CODE_SEG_INDEX, 0, (uint64_t)-1, CODE64_SEG);
@@ -154,8 +160,6 @@ static void gdt_init(void)
"r"(DATA_SEG_INDEX << 3),
"r"(TASK_SEG_INDEX << 3)
);
-
-
}
static void idt_init(void)
@@ -182,3 +186,12 @@ void cpu_init(void)
idt_init();
}
+void isr_install(int vec, void *isr, int ist)
+{
+ set_idt(vec, CODE_SEG_INDEX << 3, (uint64_t)isr, INT64_GATE);
+ if (ist)
+ {
+ set_ist(vec, ist);
+ }
+}
+
diff --git a/kernel/cpu.h b/kernel/cpu.h
index 954762f..feded83 100644
--- a/kernel/cpu.h
+++ b/kernel/cpu.h
@@ -1,4 +1,5 @@
#pragma once
void cpu_init(void);
+void isr_install(int vec, void *isr, int ist);