aboutsummaryrefslogtreecommitdiff
path: root/i686/isr.c
blob: 862f74ae052bfd3e569ffd89c864852bb4c8f6f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
 * Interrupt Service Routines
 */

#include "idt.h"
#include "sys/control.h"
#include <stdio.h>

__attribute__((interrupt)) void
abort_handler(struct interrupt_frame *frame)
{
  printf("### system abort ###\n");
  printf("#   ip: %x cs=%x\n", frame->ip, frame->cs);
  printf("#   sp: %x ss=%x\n", frame->sp, frame->ss);
  printf("#   flags: %x\n", frame->flags);
  abort();
}

__attribute__((interrupt)) void
syscall_handler(__attribute__((unused)) struct interrupt_frame *frame)
{
  unsigned int n;
  asm volatile("mov %%eax, %0" : "=r"(n));
  printf("syscall %x\n, n");
  abort();
}

void pic_clear(unsigned char irq);

__attribute__((interrupt)) void
irq0x00(__attribute__((unused)) struct interrupt_frame *frame)
{
  pic_clear(0x00);
}

extern void ps2_keyboard_irq_handler();
__attribute__((interrupt)) void
irq0x01(__attribute__((unused)) struct interrupt_frame *frame)
{
  ps2_keyboard_irq_handler();
  pic_clear(0x01);
}

__attribute__((interrupt)) void
irq0x0c(__attribute__((unused)) struct interrupt_frame *frame)
{
  printf("irq 0x0c\n");
  pic_clear(0x0c);
}