Handout
This commit is contained in:
39
kernel/interrupt/handlers.asm
Normal file
39
kernel/interrupt/handlers.asm
Normal file
@@ -0,0 +1,39 @@
|
||||
[SECTION .text]
|
||||
[EXTERN handle_keyboard]
|
||||
[GLOBAL handle_keyboard_asm]
|
||||
|
||||
; entry point for an interrupt to trigger a kernelpanic
|
||||
;
|
||||
align 16
|
||||
handle_keyboard_asm:
|
||||
; The interrupt may be triggered asynchronously, therefore the whole context
|
||||
; has to be saved and restored, or the interrupted code might not be able to
|
||||
; continue. The C++ compiler will only generates code to preserve
|
||||
; non-scratch registers in the high-level interrupt handler -- the scratch
|
||||
; registers have to be saved (and restored later) manually!
|
||||
push rax
|
||||
push rcx
|
||||
push rdx
|
||||
push rsi
|
||||
push rdi
|
||||
push r8
|
||||
push r9
|
||||
push r10
|
||||
push r11
|
||||
|
||||
; Clear direction flag for string operations
|
||||
cld
|
||||
; Call the high-level handler routine
|
||||
call handle_keyboard
|
||||
|
||||
; Restore scratch registers
|
||||
pop r11
|
||||
pop r10
|
||||
pop r9
|
||||
pop r8
|
||||
pop rdi
|
||||
pop rsi
|
||||
pop rdx
|
||||
pop rcx
|
||||
pop rax
|
||||
iretq
|
||||
Reference in New Issue
Block a user