view cos/kernel/asmcode.asm @ 29:7e3bdcb391dc

Added get_page function to mm
author windel
date Thu, 29 Dec 2011 19:34:01 +0100
parents 47b7df514243
children 88590c42320f
line wrap: on
line source

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

section .text
align 4

; Function to read the current instruction pointer value:
global read_rip
read_rip:
   pop rax
   jmp rax

global loadIDT
loadIDT:
  extern idtP
  ; TODO: make this pointer thing more insightfull:
  lidt [idtP]
  ret

%macro pushAll 0
  push rax
  push rcx
  push rdx
  push rbx
  push rbp
  push rsi
  push rdi
%endmacro

%macro popAll 0
  pop rdi
  pop rsi
  pop rbp
  pop rbx
  pop rdx
  pop rcx
  pop rax
%endmacro

; Define macro with two arguments:
%macro INTX 2
global %1
%1:
 ; Do some saving:
 cli
 pushAll
 ;xchg bx,bx

 extern %2
 call %2
 ; Do restoration
 popAll
 ;xchg bx, bx
 sti
 iretq

%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