Mercurial > lcfOS
view cos/kernel/asmcode.asm @ 25:d3c4bf3720a3
Beginning of multitasking
author | windel |
---|---|
date | Tue, 27 Dec 2011 13:31:38 +0100 |
parents | 66e9c332c845 |
children | 47b7df514243 |
line wrap: on
line source
; The default interrupt handlers. ; from 20 - 31 are reserved vectors. ; below are the custom ones! section .text align 4 global halt halt: cli hlt ; Function to read the current instruction pointer value: global read_rip read_rip: pop rax jmp rax global magicBochsBreak magicBochsBreak: xchg bx, bx ret global loadIDT loadIDT: extern idtP ; TODO: make this pointer thing more insightfull: ;xchg bx, bx ; For debugging with bochs 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