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

#define cli() \
  __asm__ volatile ("cli")

#define sti() \
  __asm__ volatile ("sti")

#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);