Guest User

ISRs assembly code

a guest
Sep 26th, 2016
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. global isr0
  2. ; rest of the globals go here
  3. global isr31
  4.  
  5. extern fault_handler
  6.  
  7. ; Divide By Zero Exception
  8.  
  9. isr0:
  10.     cli
  11.     push byte 0             ; a normal ISR stub that pushes a dummy error code to keep a uniform stack frame
  12.     push byte 0
  13.     jmp isr_common_stub    
  14.  
  15. ; rest of the ISRs go here
  16.  
  17. ; Reserved
  18.  
  19. isr31:
  20.     cli
  21.     push byte 0
  22.     push byte 31
  23.     jmp isr_common_stub
  24.  
  25. isr_common_stub:
  26.     pusha
  27.     push ds
  28.     push es
  29.     push fs
  30.     push gs
  31.     mov ax, 0x10            ; load the kernel data segment descriptor
  32.     mov ds, ax
  33.     mov es, ax
  34.     mov fs, ax
  35.     mov gs, ax
  36.     push eax
  37.     call fault_handler
  38.     pop eax
  39.     pop gs
  40.     pop fs
  41.     pop es
  42.     pop ds
  43.     popa
  44.     add esp, 8              ; cleans up the pushed error code and ISR number
  45.     iret                    ; pop CS, EIP, EFLAGS, SS, ESP
Advertisement
Add Comment
Please, Sign In to add comment