register interrupts 0x08 - 0x0f
This commit is contained in:
parent
e9898e829b
commit
7c6a18d77a
3 changed files with 19 additions and 5 deletions
|
@ -22,5 +22,9 @@ int main(int, char **) {
|
|||
}
|
||||
mercury::syscall::draw_framebuffer();
|
||||
|
||||
return 1 / 0;
|
||||
//*(int *)0x12345678 = 0;
|
||||
//fb_width = *(uint32_t *)0xffffffffc0000000;
|
||||
//return 100 / (uint8_t)(uint64_t)fb;
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
|
|
@ -64,6 +64,8 @@ exception_info:
|
|||
resq 1
|
||||
.r15:
|
||||
resq 1
|
||||
.cr2:
|
||||
resq 1
|
||||
.cr3:
|
||||
resq 1
|
||||
.rip:
|
||||
|
@ -181,6 +183,8 @@ exception_common:
|
|||
pop rax
|
||||
mov qword [exception_info.rsp], rax
|
||||
|
||||
mov rax, cr2
|
||||
mov qword [exception_info.cr2], rax
|
||||
mov rax, cr3
|
||||
mov qword [exception_info.cr3], rax
|
||||
|
||||
|
@ -200,7 +204,7 @@ set_isr:
|
|||
shr rdx, 16
|
||||
mov dword [rdi + 8], edx
|
||||
|
||||
or sil, 0xef
|
||||
or sil, 0x8e
|
||||
mov byte [rdi + 5], sil
|
||||
mov word [rdi + 2], 0x28
|
||||
mov byte [rdi + 4], 1
|
||||
|
@ -225,13 +229,13 @@ section .text
|
|||
|
||||
load_gdt_and_idt:
|
||||
|
||||
mov rcx, 8
|
||||
mov rcx, 16
|
||||
|
||||
.loop:
|
||||
|
||||
mov rdi, rcx
|
||||
dec rdi
|
||||
mov sil, 1
|
||||
mov sil, 0
|
||||
mov rdx, qword [exception_isrs + rdi * 8]
|
||||
call set_isr
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ struct [[gnu::packed]] exception_info_t {
|
|||
uint64_t r14;
|
||||
uint64_t r15;
|
||||
|
||||
uint64_t cr2;
|
||||
uint64_t cr3;
|
||||
uint64_t rip;
|
||||
uint64_t rflags;
|
||||
|
@ -103,7 +104,12 @@ extern "C" [[noreturn]] void print_exception() {
|
|||
if (((exception_info.rflags >> i) & 1) == 1)
|
||||
terminal::put_string_sz(flag_names[i]);
|
||||
|
||||
print_line("rip", "cr3", exception_info.rip, exception_info.cr3);
|
||||
if (exception_info.exception_number == 0x0e) {
|
||||
terminal::put_string_sz("\n cr2: 0x");
|
||||
terminal::put_int_hex(exception_info.cr2, 16);
|
||||
}
|
||||
|
||||
print_line("cr3", "rip", exception_info.cr3, exception_info.rip);
|
||||
print_line("rax", "rbx", exception_info.rax, exception_info.rbx);
|
||||
print_line("rcx", "rdx", exception_info.rcx, exception_info.rdx);
|
||||
print_line("rdi", "rsi", exception_info.rdi, exception_info.rsi);
|
||||
|
|
Reference in a new issue