Unify the regs that are saved by the kernel

This commit is contained in:
Baptiste Wicht 2014-01-26 21:22:53 +01:00
parent 545ed86680
commit 559ca93e8d
2 changed files with 27 additions and 26 deletions

View File

@ -224,14 +224,14 @@ void _fault_handler(interrupt::fault_regs regs){
__asm__ __volatile__("hlt" : : );
}
void _irq_handler(size_t code){
void _irq_handler(interrupt::syscall_regs regs){
//If there is an handler, call it
if(irq_handlers[code]){
irq_handlers[code]();
if(irq_handlers[regs.code]){
irq_handlers[regs.code]();
}
//If the IRQ is on the slave controller, send EOI to it
if(code >= 8){
if(regs.code >= 8){
out_byte(0xA0, 0x20);
}
@ -240,7 +240,7 @@ void _irq_handler(size_t code){
}
void _syscall_handler(interrupt::syscall_regs regs){
//If there is a handler call, it
//If there is a handler call it
if(syscall_handlers[regs.code]){
syscall_handlers[regs.code](regs);
}

View File

@ -14,8 +14,7 @@
_irq\number:
cli
push rdi
mov rdi, \number
push \number
jmp irq_common_handler
.endm
@ -40,16 +39,17 @@ create_irq 15
// Common handler
irq_common_handler:
push rax
push rcx
push rdx
push rsi
push rdi
push r8
push r9
push r10
push r11
push r12
push r11
push r10
push r9
push r8
push rdi
push rsi
push rdx
push rcx
push rbx
push rax
restore_kernel_segments
@ -57,18 +57,19 @@ irq_common_handler:
restore_user_segments
pop r12
pop r11
pop r10
pop r9
pop r8
pop rdi
pop rsi
pop rdx
pop rcx
pop rax
pop rbx
pop rcx
pop rdx
pop rsi
pop rdi
pop r8
pop r9
pop r10
pop r11
pop r12
//Was pushed by the base handler code
pop rdi
add rsp, 8
iretq // iret will clean the other automatically pushed stuff