kernel

hobby kernel
git clone git://git.evenfri.xyz/kernel.git
Log | Files | Refs | README | LICENSE

ints.asm (1046B)


      1 bits 32
      2 
      3 extern excp_handler
      4 
      5 %macro isr_no_err_stub 1
      6 global isr_stub_%1
      7 isr_stub_%1:
      8   push dword 0
      9   push dword %1
     10   jmp isr_common_stub
     11 %endmacro
     12 
     13 %macro isr_err_stub 1
     14 global isr_stub_%1
     15 isr_stub_%1:
     16   push dword %1
     17   jmp isr_common_stub
     18 %endmacro
     19 
     20 section .text
     21 
     22 isr_common_stub:
     23   pusha
     24 
     25   mov ax, ds
     26   push eax
     27 
     28   mov ax, 0x10
     29   mov ds, ax
     30   mov es, ax
     31 
     32   call excp_handler
     33 
     34   pop eax
     35   mov ds, ax
     36   mov es, ax
     37 
     38   popa
     39   add esp, 8
     40   iret
     41 
     42 isr_no_err_stub 0
     43 isr_no_err_stub 1
     44 isr_no_err_stub 2
     45 isr_no_err_stub 3
     46 isr_no_err_stub 4
     47 isr_no_err_stub 5
     48 isr_no_err_stub 6
     49 isr_no_err_stub 7
     50 isr_err_stub    8
     51 isr_no_err_stub 9
     52 isr_err_stub    10
     53 isr_err_stub    11
     54 isr_err_stub    12
     55 isr_err_stub    13
     56 isr_err_stub    14
     57 isr_no_err_stub 15
     58 isr_no_err_stub 16
     59 isr_err_stub    17
     60 isr_no_err_stub 18
     61 isr_no_err_stub 19
     62 isr_no_err_stub 20
     63 isr_no_err_stub 21
     64 isr_no_err_stub 22
     65 isr_no_err_stub 23
     66 isr_no_err_stub 24
     67 isr_no_err_stub 25
     68 isr_no_err_stub 26
     69 isr_no_err_stub 27
     70 isr_no_err_stub 28
     71 isr_no_err_stub 29
     72 isr_err_stub    30
     73 isr_no_err_stub 31