1
0
Fork 0
mirror of https://github.com/tailix/kernel.git synced 2025-02-10 15:36:37 -05:00

Rename "isr" entity to "exception"

This commit is contained in:
Braiden Vasco 2017-11-03 02:27:21 +00:00
parent 18fa71b24a
commit 252f8baf49
6 changed files with 144 additions and 144 deletions

View file

@ -6,8 +6,8 @@ CC = $(CCPREFIX)gcc
OBJS = boot.s.o main.c.o
OBJS += logger.c.o console.c.o
OBJS += multiboot.c.o
OBJS += isr.c.o isr.asm.cpp.o
OBJS += protected.c.o protected.asm.cpp.o
OBJS += exception.c.o exception.asm.cpp.o
all: kernel

78
arch/exception.asm Normal file
View file

@ -0,0 +1,78 @@
#include "config.h"
[EXTERN exception_handler]
%macro EXCEPTION_NOERRCODE 1
[GLOBAL exception_%1]
exception_%1:
cli
push byte 0
push byte %1
jmp exception_common_stub
%endmacro
%macro EXCEPTION_ERRCODE 1
[GLOBAL exception_%1]
exception_%1:
cli
push byte %1
jmp exception_common_stub
%endmacro
EXCEPTION_NOERRCODE 0 ; #DE - Divide Error Exception
EXCEPTION_NOERRCODE 1 ; #DB - Debug Exception
EXCEPTION_NOERRCODE 2 ; NMI - Non-maskable interrupt
EXCEPTION_NOERRCODE 3 ; #BP - Breakpoint Exception
EXCEPTION_NOERRCODE 4 ; #OF - Overflow Exception
EXCEPTION_NOERRCODE 5 ; #BR - BOUND Range Exceeded Exception
EXCEPTION_NOERRCODE 6 ; #UD - Invalid Opcode Exception
EXCEPTION_NOERRCODE 7 ; #NM - Device Not Available Exception
EXCEPTION_ERRCODE 8 ; #DF - Double Fault Exception
EXCEPTION_NOERRCODE 9 ; Reserved - Coprocessor Segment Overrun
EXCEPTION_ERRCODE 10 ; #TS - Invalid TSS Exception
EXCEPTION_ERRCODE 11 ; #NP - Segment Not Present
EXCEPTION_ERRCODE 12 ; #SS - Stack Fault Exception
EXCEPTION_ERRCODE 13 ; #GP - General Protection Exception
EXCEPTION_ERRCODE 14 ; #PF - Page-Fault Exception
EXCEPTION_NOERRCODE 15 ; Reserved
EXCEPTION_NOERRCODE 16 ; #MF - x87 FPU Floating-Point Error
EXCEPTION_ERRCODE 17 ; #AC - Alignment Check Exception
EXCEPTION_NOERRCODE 18 ; #MC - Machine-Check Exception
EXCEPTION_NOERRCODE 19 ; #XF - SIMD Floating-Point Exception
EXCEPTION_NOERRCODE 20 ; Reserved
EXCEPTION_NOERRCODE 21 ; Reserved
EXCEPTION_NOERRCODE 22 ; Reserved
EXCEPTION_NOERRCODE 23 ; Reserved
EXCEPTION_NOERRCODE 24 ; Reserved
EXCEPTION_NOERRCODE 25 ; Reserved
EXCEPTION_NOERRCODE 26 ; Reserved
EXCEPTION_NOERRCODE 27 ; Reserved
EXCEPTION_NOERRCODE 28 ; Reserved
EXCEPTION_NOERRCODE 29 ; Reserved
EXCEPTION_NOERRCODE 30 ; Reserved
EXCEPTION_NOERRCODE 31 ; Reserved
exception_common_stub:
pusha ; Pushes edi,esi,ebp,esp,ebx,edx,ecx,eax
mov ax, ds ; Lower 16-bits of eax = ds.
push eax ; save the data segment descriptor
mov ax, GDT_KERNEL_DS_SELECTOR
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
call exception_handler
pop eax ; reload the original data segment descriptor
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
popa ; Pops edi,esi,ebp...
add esp, 8 ; Cleans up the pushed error code and pushed ISR number
sti
iret ; pops 5 things at once: CS, EIP, EFLAGS, SS, and ESP

View file

@ -42,7 +42,7 @@ static const char *const messages[] = {
"Unhandled interrupt: 0x1F",
};
void isr(struct IsrRegisters regs)
void exception_handler(struct IsrRegisters regs)
{
logger_warn(messages[regs.int_no]);
}

View file

@ -1,37 +1,37 @@
#ifndef KERNELMQ_INCLUDED_EXCEPTION
#define KERNELMQ_INCLUDED_EXCEPTION 1
void isr0();
void isr1();
void isr2();
void isr3();
void isr4();
void isr5();
void isr6();
void isr7();
void isr8();
void isr9();
void isr10();
void isr11();
void isr12();
void isr13();
void isr14();
void isr15();
void isr16();
void isr17();
void isr18();
void isr19();
void isr20();
void isr21();
void isr22();
void isr23();
void isr24();
void isr25();
void isr26();
void isr27();
void isr28();
void isr29();
void isr30();
void isr31();
void exception_0();
void exception_1();
void exception_2();
void exception_3();
void exception_4();
void exception_5();
void exception_6();
void exception_7();
void exception_8();
void exception_9();
void exception_10();
void exception_11();
void exception_12();
void exception_13();
void exception_14();
void exception_15();
void exception_16();
void exception_17();
void exception_18();
void exception_19();
void exception_20();
void exception_21();
void exception_22();
void exception_23();
void exception_24();
void exception_25();
void exception_26();
void exception_27();
void exception_28();
void exception_29();
void exception_30();
void exception_31();
#endif

View file

@ -1,78 +0,0 @@
#include "config.h"
[EXTERN isr]
%macro ISR_NOERRCODE 1
[GLOBAL isr%1]
isr%1:
cli
push byte 0
push byte %1
jmp isr_common_stub
%endmacro
%macro ISR_ERRCODE 1
[GLOBAL isr%1]
isr%1:
cli
push byte %1
jmp isr_common_stub
%endmacro
ISR_NOERRCODE 0 ; #DE - Divide Error Exception
ISR_NOERRCODE 1 ; #DB - Debug Exception
ISR_NOERRCODE 2 ; NMI - Non-maskable interrupt
ISR_NOERRCODE 3 ; #BP - Breakpoint Exception
ISR_NOERRCODE 4 ; #OF - Overflow Exception
ISR_NOERRCODE 5 ; #BR - BOUND Range Exceeded Exception
ISR_NOERRCODE 6 ; #UD - Invalid Opcode Exception
ISR_NOERRCODE 7 ; #NM - Device Not Available Exception
ISR_ERRCODE 8 ; #DF - Double Fault Exception
ISR_NOERRCODE 9 ; Reserved - Coprocessor Segment Overrun
ISR_ERRCODE 10 ; #TS - Invalid TSS Exception
ISR_ERRCODE 11 ; #NP - Segment Not Present
ISR_ERRCODE 12 ; #SS - Stack Fault Exception
ISR_ERRCODE 13 ; #GP - General Protection Exception
ISR_ERRCODE 14 ; #PF - Page-Fault Exception
ISR_NOERRCODE 15 ; Reserved
ISR_NOERRCODE 16 ; #MF - x87 FPU Floating-Point Error
ISR_ERRCODE 17 ; #AC - Alignment Check Exception
ISR_NOERRCODE 18 ; #MC - Machine-Check Exception
ISR_NOERRCODE 19 ; #XF - SIMD Floating-Point Exception
ISR_NOERRCODE 20 ; Reserved
ISR_NOERRCODE 21 ; Reserved
ISR_NOERRCODE 22 ; Reserved
ISR_NOERRCODE 23 ; Reserved
ISR_NOERRCODE 24 ; Reserved
ISR_NOERRCODE 25 ; Reserved
ISR_NOERRCODE 26 ; Reserved
ISR_NOERRCODE 27 ; Reserved
ISR_NOERRCODE 28 ; Reserved
ISR_NOERRCODE 29 ; Reserved
ISR_NOERRCODE 30 ; Reserved
ISR_NOERRCODE 31 ; Reserved
isr_common_stub:
pusha ; Pushes edi,esi,ebp,esp,ebx,edx,ecx,eax
mov ax, ds ; Lower 16-bits of eax = ds.
push eax ; save the data segment descriptor
mov ax, GDT_KERNEL_DS_SELECTOR
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
call isr
pop eax ; reload the original data segment descriptor
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
popa ; Pops edi,esi,ebp...
add esp, 8 ; Cleans up the pushed error code and pushed ISR number
sti
iret ; pops 5 things at once: CS, EIP, EFLAGS, SS, and ESP

View file

@ -64,38 +64,38 @@ void protected_initialize()
*p = 0;
}
idt_set_gate(0, (unsigned int)isr0, 0x08, 0x8E);
idt_set_gate(1, (unsigned int)isr1, 0x08, 0x8E);
idt_set_gate(2, (unsigned int)isr2, 0x08, 0x8E);
idt_set_gate(3, (unsigned int)isr3, 0x08, 0x8E);
idt_set_gate(4, (unsigned int)isr4, 0x08, 0x8E);
idt_set_gate(5, (unsigned int)isr5, 0x08, 0x8E);
idt_set_gate(6, (unsigned int)isr6, 0x08, 0x8E);
idt_set_gate(7, (unsigned int)isr7, 0x08, 0x8E);
idt_set_gate(8, (unsigned int)isr8, 0x08, 0x8E);
idt_set_gate(9, (unsigned int)isr9, 0x08, 0x8E);
idt_set_gate(10, (unsigned int)isr10, 0x08, 0x8E);
idt_set_gate(11, (unsigned int)isr11, 0x08, 0x8E);
idt_set_gate(12, (unsigned int)isr12, 0x08, 0x8E);
idt_set_gate(13, (unsigned int)isr13, 0x08, 0x8E);
idt_set_gate(14, (unsigned int)isr14, 0x08, 0x8E);
idt_set_gate(15, (unsigned int)isr15, 0x08, 0x8E);
idt_set_gate(16, (unsigned int)isr16, 0x08, 0x8E);
idt_set_gate(17, (unsigned int)isr17, 0x08, 0x8E);
idt_set_gate(18, (unsigned int)isr18, 0x08, 0x8E);
idt_set_gate(19, (unsigned int)isr19, 0x08, 0x8E);
idt_set_gate(20, (unsigned int)isr20, 0x08, 0x8E);
idt_set_gate(21, (unsigned int)isr21, 0x08, 0x8E);
idt_set_gate(22, (unsigned int)isr22, 0x08, 0x8E);
idt_set_gate(23, (unsigned int)isr23, 0x08, 0x8E);
idt_set_gate(24, (unsigned int)isr24, 0x08, 0x8E);
idt_set_gate(25, (unsigned int)isr25, 0x08, 0x8E);
idt_set_gate(26, (unsigned int)isr26, 0x08, 0x8E);
idt_set_gate(27, (unsigned int)isr27, 0x08, 0x8E);
idt_set_gate(28, (unsigned int)isr28, 0x08, 0x8E);
idt_set_gate(29, (unsigned int)isr29, 0x08, 0x8E);
idt_set_gate(30, (unsigned int)isr30, 0x08, 0x8E);
idt_set_gate(31, (unsigned int)isr31, 0x08, 0x8E);
idt_set_gate(0, (unsigned int)exception_0, 0x08, 0x8E);
idt_set_gate(1, (unsigned int)exception_1, 0x08, 0x8E);
idt_set_gate(2, (unsigned int)exception_2, 0x08, 0x8E);
idt_set_gate(3, (unsigned int)exception_3, 0x08, 0x8E);
idt_set_gate(4, (unsigned int)exception_4, 0x08, 0x8E);
idt_set_gate(5, (unsigned int)exception_5, 0x08, 0x8E);
idt_set_gate(6, (unsigned int)exception_6, 0x08, 0x8E);
idt_set_gate(7, (unsigned int)exception_7, 0x08, 0x8E);
idt_set_gate(8, (unsigned int)exception_8, 0x08, 0x8E);
idt_set_gate(9, (unsigned int)exception_9, 0x08, 0x8E);
idt_set_gate(10, (unsigned int)exception_10, 0x08, 0x8E);
idt_set_gate(11, (unsigned int)exception_11, 0x08, 0x8E);
idt_set_gate(12, (unsigned int)exception_12, 0x08, 0x8E);
idt_set_gate(13, (unsigned int)exception_13, 0x08, 0x8E);
idt_set_gate(14, (unsigned int)exception_14, 0x08, 0x8E);
idt_set_gate(15, (unsigned int)exception_15, 0x08, 0x8E);
idt_set_gate(16, (unsigned int)exception_16, 0x08, 0x8E);
idt_set_gate(17, (unsigned int)exception_17, 0x08, 0x8E);
idt_set_gate(18, (unsigned int)exception_18, 0x08, 0x8E);
idt_set_gate(19, (unsigned int)exception_19, 0x08, 0x8E);
idt_set_gate(20, (unsigned int)exception_20, 0x08, 0x8E);
idt_set_gate(21, (unsigned int)exception_21, 0x08, 0x8E);
idt_set_gate(22, (unsigned int)exception_22, 0x08, 0x8E);
idt_set_gate(23, (unsigned int)exception_23, 0x08, 0x8E);
idt_set_gate(24, (unsigned int)exception_24, 0x08, 0x8E);
idt_set_gate(25, (unsigned int)exception_25, 0x08, 0x8E);
idt_set_gate(26, (unsigned int)exception_26, 0x08, 0x8E);
idt_set_gate(27, (unsigned int)exception_27, 0x08, 0x8E);
idt_set_gate(28, (unsigned int)exception_28, 0x08, 0x8E);
idt_set_gate(29, (unsigned int)exception_29, 0x08, 0x8E);
idt_set_gate(30, (unsigned int)exception_30, 0x08, 0x8E);
idt_set_gate(31, (unsigned int)exception_31, 0x08, 0x8E);
logger_info("Load GDT.");