mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 12:48:22 +00:00
x86_64 interrupts: push interrupt numbers and also add an isr for #NM
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user