diff options
author | Anton Kling <anton@kling.gg> | 2024-02-07 11:36:21 +0100 |
---|---|---|
committer | Anton Kling <anton@kling.gg> | 2024-02-07 22:25:47 +0100 |
commit | 35958c8c6b600482f68fef08ac26547b5655e987 (patch) | |
tree | a3329136adc1b92885c60462e7dd74c98eaa0953 /kernel/drivers/pit.c | |
parent | b7fa1457727338416499d1b0144f1042a6878a97 (diff) |
A lot of small changes
Diffstat (limited to 'kernel/drivers/pit.c')
-rw-r--r-- | kernel/drivers/pit.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/kernel/drivers/pit.c b/kernel/drivers/pit.c index 567ac2d..8f9c35c 100644 --- a/kernel/drivers/pit.c +++ b/kernel/drivers/pit.c @@ -41,17 +41,24 @@ void set_pit_count(u16 hertz) { outb(PIT_IO_CHANNEL_0, (divisor & 0xFF00) >> 8); } -__attribute__((interrupt)) void -int_clock(__attribute__((unused)) struct interrupt_frame *frame) { +__attribute__((interrupt)) void int_clock(registers_t *regs) { + process_t *p = get_current_task(); + if (p) { + // FIXME: For some reason eflags is the esp? I have read the + // manual multilpe times and still can't figure out why. + if (regs->eflags <= 0x90000000 && regs->eflags) { + p->useresp = regs->eflags; + } + } outb(0x20, 0x20); pit_counter++; if (pit_counter >= hertz / 1000) { pit_counter = 0; clock_num_ms_ticks++; } - switch_task(); + switch_task(1); } void pit_install(void) { - install_handler(int_clock, INT_32_INTERRUPT_GATE(0x0), 0x20); + install_handler(int_clock, INT_32_INTERRUPT_GATE(0x3), 0x20); } |