aboutsummaryrefslogtreecommitdiff
path: root/kernel/drivers
diff options
context:
space:
mode:
authorMarvin Borner2020-10-26 16:36:40 +0100
committerMarvin Borner2020-10-26 16:36:40 +0100
commit197ea3ca20879b29fca41a07cf43e5b04b9c5083 (patch)
treec0e0223e289bde3af7cca995f98d681779bfda26 /kernel/drivers
parent4ae48304b2290b6c835eb3d937bd5e905ce0e5d4 (diff)
Optimizations
Diffstat (limited to 'kernel/drivers')
-rw-r--r--kernel/drivers/fpu.c2
-rw-r--r--kernel/drivers/ide.c2
-rw-r--r--kernel/drivers/interrupts.c17
-rw-r--r--kernel/drivers/timer.c4
4 files changed, 12 insertions, 13 deletions
diff --git a/kernel/drivers/fpu.c b/kernel/drivers/fpu.c
index d8a2b79..f7eeceb 100644
--- a/kernel/drivers/fpu.c
+++ b/kernel/drivers/fpu.c
@@ -10,7 +10,7 @@ void set_fpu_cw(const u16 cw)
void fpu_install()
{
__asm__ volatile("clts");
- u32 t;
+ u32 t = 0;
__asm__ volatile("mov %%cr0, %0" : "=r"(t));
t &= ~(1 << 2);
t |= (1 << 1);
diff --git a/kernel/drivers/ide.c b/kernel/drivers/ide.c
index c1c0227..1a94ae3 100644
--- a/kernel/drivers/ide.c
+++ b/kernel/drivers/ide.c
@@ -16,7 +16,7 @@ int ide_stat()
void ide_wait()
{
- u8 stat;
+ u8 stat = 0;
do
stat = ide_stat();
while ((stat & IDE_BUSY) != 0);
diff --git a/kernel/drivers/interrupts.c b/kernel/drivers/interrupts.c
index 9088915..57b0ab5 100644
--- a/kernel/drivers/interrupts.c
+++ b/kernel/drivers/interrupts.c
@@ -6,6 +6,7 @@
#include <interrupts.h>
#include <mem.h>
#include <print.h>
+#include <proc.h>
#include <serial.h>
/**
@@ -166,18 +167,18 @@ void isr_uninstall_handler(int isr)
void isr_handler(struct regs *r)
{
- void (*handler)(struct regs * r);
-
// Execute fault handler if exists
- handler = isr_routines[r->int_no];
+ void (*handler)(struct regs * r) = isr_routines[r->int_no];
if (handler) {
handler(r);
} else if (r->int_no <= 32) {
- cli();
- printf("\n%s Exception, halting!\n", isr_exceptions[r->int_no]);
- printf("Error code: %d\n", r->err_code);
- while (1) {
- };
+ printf("%s Exception, exiting!\n", isr_exceptions[r->int_no]);
+ struct proc *proc = proc_current();
+ if (proc)
+ proc_exit(proc, 1);
+ else
+ __asm__ volatile("cli\nhlt");
+ proc_yield(r);
}
}
diff --git a/kernel/drivers/timer.c b/kernel/drivers/timer.c
index 812bde7..3bc1811 100644
--- a/kernel/drivers/timer.c
+++ b/kernel/drivers/timer.c
@@ -31,9 +31,7 @@ void timer_handler()
// "Delay" function with CPU sleep
void timer_wait(u32 ticks)
{
- u32 eticks;
-
- eticks = timer_ticks + ticks;
+ u32 eticks = timer_ticks + ticks;
while (timer_ticks < eticks) {
__asm__ volatile("sti//hlt//cli");
}