view cos/kernel/asmcode.asm @ 14:a58904747019

Added asm interrupt handler things, not yet working
author windel
date Mon, 14 Nov 2011 22:45:55 +0100
parents
children f3e3e0e9c4bc
line wrap: on
line source

; The default interrupt handlers.
; from 20 - 31 are reserved vectors.
; below are the custom ones!

section .text
align 4

; Port helpers:
global outb
outb:
  mov eax, [esp + 8]
  mov edx, [esp + 4]
  out dx, al
  ret

global inb
inb:
  xor eax, eax
  mov edx, [esp + 4]
  in al, dx
  ret

; Helper functions:
global enableinterrupts
enableinterrupts:
  sti
  ret

global halt
halt:
  cli
  hlt

global loadIDT
loadIDT:
  ret

; Define macro with two arguments:
%macro INTX 2
global %1
%1:
 ; Do some saving:
extern %2
     call %2
 ; Do restoration
     iret

%endmacro

; Exception handlers:
INTX INTDEF, INTDEF_handler
INTX INT0, INT0handler
INTX INT1, INT1handler
INTX INT2, INT2handler
INTX INT3, INT3handler
INTX INT4, INT4handler
INTX INT5, INT5handler
INTX INT6, INT6handler
INTX INT7, INT7handler
INTX INT8, INT8handler
INTX INT9, INT9handler
INTX INT10, INT10handler
INTX INT11, INT11handler
INTX INT12, INT12handler
INTX INT13, INT13handler
INTX INT14, INT14handler
INTX INT15, INT15handler
INTX INT16, INT16handler
INTX INT17, INT17handler
INTX INT18, INT18handler
INTX INT19, INT19handler

INTX INT32, INT32handler
INTX INT33, INT33handler
INTX INT34, INT34handler