From 5481848e27fdd4fc859def9841a0283665531a46 Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Sun, 13 Sep 2020 17:12:29 -0400 Subject: fixed some paging bugs, added fault handlers and new programs --- src/kernel/isrs.asm | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 71 insertions(+), 2 deletions(-) (limited to 'src/kernel/isrs.asm') diff --git a/src/kernel/isrs.asm b/src/kernel/isrs.asm index 9a9600c..4f2d4e2 100644 --- a/src/kernel/isrs.asm +++ b/src/kernel/isrs.asm @@ -6,6 +6,14 @@ global yield_isr global _start_user_mode global kbd_isr +global udf_isr +global dfa_isr +global tsf_isr +global npf_isr +global ssf_isr +global gpf_isr +global pff_isr + extern syscall_table extern active_task @@ -13,14 +21,26 @@ extern delete_task extern advance_active_task extern on_kbd_isr extern make_sure_tasks +extern exception_halt n_syscalls equ 0x9 +;section .bss +;_debug_is_start_task resb 1 +;extern switch_to_kernel_cr3 +;extern switch_to_task_cr3 + section .text syscall_isr: cmp eax, n_syscalls jge .bad +; mov byte [_debug_is_start_task], 0 +; cmp eax, 0x4 +; jne .dont_set_debug +; mov byte [_debug_is_start_task], 1 +;.dont_set_debug: + mov eax, dword [syscall_table + eax * 4] push edi @@ -33,6 +53,16 @@ syscall_isr: add esp, 20 +; cmp byte [_debug_is_start_task], 0 +; je .dont_do_debug +; push eax +; call switch_to_kernel_cr3 +; jmp $ +; call switch_to_task_cr3 +; pop eax +;.dont_do_debug: + +._before_return: iret .bad: @@ -86,12 +116,13 @@ yield_isr: mov edi, dword [eax + 24] mov ebp, dword [eax + 28] -_before_start_task: +._before_return: iret _start_user_mode: mov ax, 0x2b mov ds, ax + mov es, ax push dword 0x2b sub esp, 4 @@ -113,4 +144,42 @@ kbd_isr: pop edx pop ecx pop eax - iret \ No newline at end of file + iret + +udf_isr: + push 0 + push udid + call exception_halt + +dfa_isr: + push dfid + call exception_halt + +tsf_isr: + push tsid + call exception_halt + +npf_isr: + push npid + call exception_halt + +ssf_isr: + push ssid + call exception_halt + +gpf_isr: + push gpid + call exception_halt + +pff_isr: + push pfid + call exception_halt + +section .rodata +udid db "UD", 0 +dfid db "DF", 0 +tsid db "TS", 0 +npid db "NP", 0 +ssid db "SS", 0 +gpid db "GP", 0 +pfid db "PF", 0 \ No newline at end of file -- cgit v1.2.3