Basic framework for getting interrupts to go, but alas nothing yet...

This commit is contained in:
Eryn Wells 2016-03-13 13:17:08 -04:00
parent c9c64b154a
commit 46d18b97d5
3 changed files with 143 additions and 0 deletions

69
src/isr.S Normal file
View file

@ -0,0 +1,69 @@
# isr.s
# Eryn Wells <eryn@erynwells.me>
# Interrupt service routine. See also: Interrupts.cc.
.section .text
.global unhandledInterrupt
.global handleDEException, handleGPException
.global handleHardwareInterrupt0, handleHardwareInterrupt1
#define SaveContext \
pushal; \
cld;
#define RestoreContext \
popal; \
iret
#define RestoreContextAndHalt \
popal; \
cli; \
hlt
// Generic handler
unhandledInterrupt:
SaveContext
call doUnhandledInterrupt
RestoreContextAndHalt
// Divide error
handleDEException:
SaveContext
pushl $0
call dispatchExceptionHandler
add $4, %esp
RestoreContextAndHalt
// Double fault
handleDFException:
SaveContext
pushl $0x08
call dispatchExceptionHandler
add $4, %esp
RestoreContextAndHalt
// General Protection fault
handleGPException:
SaveContext
pushl $0x0D
call dispatchExceptionHandler
add $4, %esp
RestoreContextAndHalt
/*
* Hardware Interrupts
*/
handleHardwareInterrupt0:
SaveContext
call handleTimerInterrupt
RestoreContext
handleHardwareInterrupt1:
SaveContext
call handleKeyboardInterrupt
RestoreContext
#undef RestoreContext
#undef SaveContext