x86_64 interrupts: push interrupt numbers and also add an isr for #NM

This commit is contained in:
Matheus
2022-11-20 20:12:06 -03:00
parent 60569cf68b
commit 75491f602f
4 changed files with 23 additions and 14 deletions
+4 -1
View File
@@ -49,12 +49,15 @@ void idt_bspinit(){
idt_setentry(&idt[VECTOR_INVALIDTSS], asmisr_except, 0x28, FLAGS_PRESENT | FLAGS_TYPE_INTERRUPT, 0);
idt_setentry(&idt[VECTOR_SEGMENTNOTPRESENT], asmisr_except, 0x28, FLAGS_PRESENT | FLAGS_TYPE_INTERRUPT, 0);
idt_setentry(&idt[VECTOR_STACK], asmisr_except, 0x28, FLAGS_PRESENT | FLAGS_TYPE_INTERRUPT, 0);
idt_setentry(&idt[VECTOR_SIMD], asmisr_simd, 0x28, FLAGS_PRESENT | FLAGS_TYPE_INTERRUPT, 0);
idt_setentry(&idt[VECTOR_PF], asmisr_pagefault, 0x28, FLAGS_PRESENT | FLAGS_TYPE_INTERRUPT, 0);
idt_setentry(&idt[VECTOR_DEVUNAVAILABLE], asmisr_nm, 0x28, FLAGS_PRESENT | FLAGS_TYPE_INTERRUPT, 0);
idt_setentry(&idt[VECTOR_PANIC], asmisr_panic, 0x28, FLAGS_PRESENT | FLAGS_TYPE_INTERRUPT, 0);
idt_setentry(&idt[VECTOR_MMUINVAL], asmisr_mmuinval, 0x28, FLAGS_PRESENT | FLAGS_TYPE_INTERRUPT, 0);
+1
View File
@@ -13,5 +13,6 @@ extern void asmisr_mmuinval();
extern void asmisr_ps2kbd();
extern void asmisr_timer();
extern void asmisr_simd();
extern void asmisr_nm();
#endif
+14 -11
View File
@@ -97,7 +97,7 @@ section .text
%endmacro
%macro isr 2
%macro isr 3
global %1
%1:
@@ -107,6 +107,7 @@ section .text
pushregs
mov rdi,rsp
mov rsi,%3
cld
extern %2
@@ -122,7 +123,7 @@ section .text
%macro except 2
%macro except 3
global %1
%1:
@@ -130,7 +131,8 @@ section .text
pushregs
mov rdi,rsp
mov rsi,%3
cld
sti
extern %2
@@ -150,11 +152,12 @@ asmisr_panic:
hlt
jmp .hlt ; NMI stuff
except asmisr_pagefault, isr_pagefault
isr asmisr_general, isr_general
except asmisr_except, isr_except
isr asmisr_lapicnmi, isr_lapicnmi
isr asmisr_mmuinval, isr_mmuinval
isr asmisr_ps2kbd, isr_ps2kbd
isr asmisr_timer, isr_timer
isr asmisr_simd, isr_simd
except asmisr_pagefault, isr_pagefault, 0xE
except asmisr_nm, isr_except, 0x7
isr asmisr_general, isr_general, 0xFF
except asmisr_except, isr_except, 0xFF
isr asmisr_lapicnmi, isr_lapicnmi, 0x21
isr asmisr_mmuinval, isr_mmuinval, 0x22
isr asmisr_ps2kbd, isr_ps2kbd, 0x40
isr asmisr_timer, isr_timer, 0x80
isr asmisr_simd, isr_simd, 0x13
+4 -2
View File
@@ -15,11 +15,13 @@ void isr_simd(arch_regs *reg){
_panic("SIMD exception", reg);
}
void isr_general(arch_regs *reg){
void isr_general(arch_regs *reg, int n){
printf("interrupt %d", n);
_panic("Unhandled interrupt", reg);
}
void isr_except(arch_regs *reg){
void isr_except(arch_regs *reg, int n){
printf("exception %d", n);
_panic("CPU Exception", reg);
}