summaryrefslogtreecommitdiff
path: root/include/asm/interrupt.h
blob: 1187fefd1086ef3e116e0721d8f527b8a91cc7d4 (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
#include <stdint.h>

#define irq_enable(n) \
  __asm__ volatile ( \
      "inb $0xA1, %%al\n" \
      "shl $8, %%ax\n" \
      "inb $0x21, %%al\n" \
      "xor $0xFFFF, %%bx\n" \
      "and %%bx, %%ax\n" \
      "outb %%al, $0x21\n" \
      "shr $8, %%ax\n" \
      "outb %%al, $0xA1\n" \
      :: "b" (n) \
      );

#define irq_disable(n) \
  __asm__ volatile ( \
      "inb $0xA1, %%al\n" \
      "shl $8, %%ax\n" \
      "inb $0x21, %%al\n" \
      "or %%bx, %%ax\n" \
      "outb %%al, $0x21\n" \
      "shr $8, %%ax\n" \
      "outb %%al, $0xA1\n" \
      :: "b" (n) \
      );

void register_isr(uint8_t n, uint8_t dpl, void *handler);
void register_trap(uint8_t n, uint8_t dpl, void *handler);