aboutsummaryrefslogtreecommitdiff
path: root/src/drivers
diff options
context:
space:
mode:
authorMarvin Borner2020-08-05 21:33:48 +0200
committerMarvin Borner2020-08-05 21:33:48 +0200
commit835960fd85989ee961b5a932f467e6e4f545d201 (patch)
treed93c67e51189eec12fb43ef860deba92e9017329 /src/drivers
parent4af62bb53676b7f721b46cabee78cac3a557e924 (diff)
Added some cpu function wrappers
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/cpu.c21
-rw-r--r--src/drivers/interrupts.c4
2 files changed, 22 insertions, 3 deletions
diff --git a/src/drivers/cpu.c b/src/drivers/cpu.c
index ba8c66f..5c27c51 100644
--- a/src/drivers/cpu.c
+++ b/src/drivers/cpu.c
@@ -46,3 +46,24 @@ void outl(u16 port, u32 data)
{
__asm__ volatile("outl %0, %1" ::"a"(data), "Nd"(port));
}
+
+void cli()
+{
+ __asm__ volatile("cli");
+}
+
+void sti()
+{
+ __asm__ volatile("sti");
+}
+
+void hlt()
+{
+ __asm__ volatile("hlt");
+}
+
+void idle()
+{
+ while (1)
+ hlt();
+}
diff --git a/src/drivers/interrupts.c b/src/drivers/interrupts.c
index 9ad2529..0b94208 100644
--- a/src/drivers/interrupts.c
+++ b/src/drivers/interrupts.c
@@ -173,7 +173,7 @@ void isr_handler(struct regs *r)
if (handler) {
handler(r);
} else if (r->int_no <= 32) {
- __asm__("cli");
+ cli();
printf("\n%s Exception, halting!\n", isr_exceptions[r->int_no]);
printf("Error code: %d\n", r->err_code);
while (1) {
@@ -218,8 +218,6 @@ void isr_install()
idt_set_gate(29, (u32)isr29, 0x08, 0x8E);
idt_set_gate(30, (u32)isr30, 0x08, 0x8E);
idt_set_gate(31, (u32)isr31, 0x08, 0x8E);
-
- idt_set_gate(0x80, (u32)isr128, 0x08, 0x8E);
}
/**