summaryrefslogtreecommitdiff
path: root/kernel/interrupts.c
diff options
context:
space:
mode:
authorMiguel <m.i@gmx.at>2018-08-22 16:35:12 +0200
committerMiguel <m.i@gmx.at>2018-08-22 16:35:12 +0200
commit98bf7b67543b36b6fe49f2b68c115ebeaf630603 (patch)
treeaad818381dfc42c4158b923d588bbe8d34f51e51 /kernel/interrupts.c
parent323fb9d3e09903d6fa43ef7e1f0cc8934414c8d4 (diff)
cleanup logging
Diffstat (limited to 'kernel/interrupts.c')
-rw-r--r--kernel/interrupts.c85
1 files changed, 42 insertions, 43 deletions
diff --git a/kernel/interrupts.c b/kernel/interrupts.c
index f9b80a8..51682b4 100644
--- a/kernel/interrupts.c
+++ b/kernel/interrupts.c
@@ -1,5 +1,4 @@
-
-
+#include "kernel/kernel.h"
#include "asm/asm.h"
#include "asm/pit.h"
#include "driver/mouse.h"
@@ -10,14 +9,14 @@
void errlog(uint32_t error_code)
{
- log(FOOLOS_MODULE_NAME,5,"error_code: 0x%08X",error_code);
+ klog("error_code: 0x%08X",error_code);
}
-void deflog(uint32_t eip, uint16_t cs, uint32_t flags)
+void defklog(uint32_t eip, uint16_t cs, uint32_t flags)
{
- log(FOOLOS_MODULE_NAME,5,"eip: 0x%08X",eip);
- log(FOOLOS_MODULE_NAME,5,"segment: 0x%08X",cs);
- log(FOOLOS_MODULE_NAME,5,"eflags: 0x%08X",flags);
+ klog("eip: 0x%08X",eip);
+ klog("segment: 0x%08X",cs);
+ klog("eflags: 0x%08X",flags);
}
void int_install_ir(int irq, uint16_t flags, uint16_t sel, void *addr);
@@ -45,63 +44,63 @@ static struct idt_desc
void exception_handle()
{
- panic(FOOLOS_MODULE_NAME,"exception interrupt");
+ kpanic("exception interrupt");
}
void int_default()
{
- log(FOOLOS_MODULE_NAME,5,"default handler");
- panic(FOOLOS_MODULE_NAME,"unhandled interrupt (is this a panic or should just iognore?)");
+ klog("default handler");
+ kpanic("unhandled interrupt (is this a panic or should just iognore?)");
}
void show_error(uint32_t err)
{
- log(FOOLOS_MODULE_NAME,5,"interrupt error code: 0x%08x",err);
- log(FOOLOS_MODULE_NAME,5,"External Event: %x",err&0b001);
- log(FOOLOS_MODULE_NAME,5,"Location: %x",err&0b110);
- log(FOOLOS_MODULE_NAME,5,"Selector: %x",err&0b1111111111111000);
+ klog("interrupt error code: 0x%08x",err);
+ klog("External Event: %x",err&0b001);
+ klog("Location: %x",err&0b110);
+ klog("Selector: %x",err&0b1111111111111000);
}
-void exception_handle_0(){ panic(FOOLOS_MODULE_NAME,"Divide by 0"); }
-void exception_handle_1(){ panic(FOOLOS_MODULE_NAME,"Single step (debugger)"); }
-void exception_handle_2(){ panic(FOOLOS_MODULE_NAME,"Non Maskable Interrupt"); }
-void exception_handle_3(){ panic(FOOLOS_MODULE_NAME,"Breakpoint (debugger)"); }
-void exception_handle_4(){ panic(FOOLOS_MODULE_NAME,"Overflow"); }
-void exception_handle_5(){ panic(FOOLOS_MODULE_NAME,"Bounds check"); }
-void exception_handle_6(){ panic(FOOLOS_MODULE_NAME,"Undefined OP Code"); }
-void exception_handle_7(){ panic(FOOLOS_MODULE_NAME,"No coprocessor"); }
-void exception_handle_8(){ panic(FOOLOS_MODULE_NAME,"Double Fault"); }
-void exception_handle_9(){ panic(FOOLOS_MODULE_NAME,"Coprocessor Segment Overrun"); }
-void exception_handle_10(){ panic(FOOLOS_MODULE_NAME,"Invalid TSS"); }
-void exception_handle_11(){ panic(FOOLOS_MODULE_NAME,"Segment Not Present"); }
-void exception_handle_12(){ panic(FOOLOS_MODULE_NAME,"Stack Segment Overrun"); }
+void exception_handle_0(){ kpanic("Divide by 0"); }
+void exception_handle_1(){ kpanic("Single step (debugger)"); }
+void exception_handle_2(){ kpanic("Non Maskable Interrupt"); }
+void exception_handle_3(){ kpanic("Breakpoint (debugger)"); }
+void exception_handle_4(){ kpanic("Overflow"); }
+void exception_handle_5(){ kpanic("Bounds check"); }
+void exception_handle_6(){ kpanic("Undefined OP Code"); }
+void exception_handle_7(){ kpanic("No coprocessor"); }
+void exception_handle_8(){ kpanic("Double Fault"); }
+void exception_handle_9(){ kpanic("Coprocessor Segment Overrun"); }
+void exception_handle_10(){ kpanic("Invalid TSS"); }
+void exception_handle_11(){ kpanic("Segment Not Present"); }
+void exception_handle_12(){ kpanic("Stack Segment Overrun"); }
void exception_handle_13(uint32_t error_code,uint32_t eip,uint16_t cs,uint16_t unused, uint32_t flags)
{
errlog(error_code);
- deflog(eip,cs,flags);
+ defklog(eip,cs,flags);
- panic(FOOLOS_MODULE_NAME,"Exception: Fault: General Protection Fault");
+ kpanic("Exception: Fault: General Protection Fault");
}
void exception_handle_14(uint32_t error_code,uint32_t eip,uint16_t cs,uint16_t unused, uint32_t flags)
{
errlog(error_code);
- log(FOOLOS_MODULE_NAME,5,"error_code_P: %d",error_code&1?1:0);
- log(FOOLOS_MODULE_NAME,5,"error_code_W/R: %d",error_code&2?1:0);
- log(FOOLOS_MODULE_NAME,5,"error_code_U/S: %d",error_code&4?1:0);
- log(FOOLOS_MODULE_NAME,5,"error_code_RSVD: %d",error_code&8?1:0);
- log(FOOLOS_MODULE_NAME,5,"error_code_I/D: %d",error_code&16?1:0);
- log(FOOLOS_MODULE_NAME,5,"at addr: 0x%08X",x86_get_cr(2));
+ klog("error_code_P: %d",error_code&1?1:0);
+ klog("error_code_W/R: %d",error_code&2?1:0);
+ klog("error_code_U/S: %d",error_code&4?1:0);
+ klog("error_code_RSVD: %d",error_code&8?1:0);
+ klog("error_code_I/D: %d",error_code&16?1:0);
+ klog("at addr: 0x%08X",x86_get_cr(2));
- deflog(eip,cs,flags);
- panic(FOOLOS_MODULE_NAME,"Exception: Fault: Page Fault");
+ defklog(eip,cs,flags);
+ kpanic("Exception: Fault: Page Fault");
}
-void exception_handle_15(){ panic(FOOLOS_MODULE_NAME,"Unassigned"); }
-void exception_handle_16(){ panic(FOOLOS_MODULE_NAME,"Coprocessor error"); }
-void exception_handle_17(){ panic(FOOLOS_MODULE_NAME,"Alignment Check"); }
-void exception_handle_18(){ panic(FOOLOS_MODULE_NAME,"Machine Check"); }
+void exception_handle_15(){ kpanic("Unassigned"); }
+void exception_handle_16(){ kpanic("Coprocessor error"); }
+void exception_handle_17(){ kpanic("Alignment Check"); }
+void exception_handle_18(){ kpanic("Machine Check"); }
//set a handler for a specific interrupt
void int_install_ir(int irq, uint16_t flags, uint16_t sel, void *addr)
@@ -119,10 +118,10 @@ void int_install_ir(int irq, uint16_t flags, uint16_t sel, void *addr)
void interrupts_init(uint16_t sel)
{
// Setup PIC
- log(FOOLOS_MODULE_NAME,5,"setting up PIC",&idt,&idtd);
+ klog("setting up PIC",&idt,&idtd);
pic_setup();
- log(FOOLOS_MODULE_NAME,5,"initializing. IDT: 0x%08x, IDTD: 0x%08X",&idt,&idtd);
+ klog("initializing. IDT: 0x%08x, IDTD: 0x%08X",&idt,&idtd);
for(int i=0; i<INT_MAX; i++)
{