mirror of
https://github.com/wichtounet/thor-os.git
synced 2025-09-18 17:15:09 -04:00
Work on interrupts (non-working state)
This commit is contained in:
parent
87efbea27c
commit
1e181830be
2
Makefile
2
Makefile
@ -29,7 +29,7 @@ bochs: thor.flp
|
||||
|
||||
debug: thor.flp
|
||||
echo "c" > commands
|
||||
bochs -qf bochsrc.txt -rc commands
|
||||
bochs -qf debug_bochsrc.txt -rc commands
|
||||
rm commands
|
||||
|
||||
force_look:
|
||||
|
@ -266,9 +266,9 @@ void memory_command(const char*){
|
||||
k_print_line("Read failed");
|
||||
} else {
|
||||
for(int i = 0; i < 80; i += 8){
|
||||
k_printf("%h %h %h %h %h %h %h %h\n",
|
||||
buffer[i+0], buffer[i+1], buffer[i+2], buffer[i+3],
|
||||
buffer[i+4], buffer[i+5], buffer[i+6], buffer[i+7]);
|
||||
k_printf("%.4h %.4h %.4h %.4h %.4h %.4h %.4h %.4h\n",
|
||||
(std::size_t) buffer[i+0], (std::size_t) buffer[i+1], (std::size_t) buffer[i+2], (std::size_t) buffer[i+3],
|
||||
(std::size_t) buffer[i+4], (std::size_t) buffer[i+5], (std::size_t) buffer[i+6], (std::size_t) buffer[i+7]);
|
||||
}
|
||||
|
||||
k_free(reinterpret_cast<std::size_t*>(buffer));
|
||||
|
@ -46,28 +46,22 @@ _isr%1:
|
||||
; Disable interruptions to avoid being interrupted
|
||||
cli
|
||||
|
||||
mov r10, [rsp]
|
||||
mov r11, [rsp+8]
|
||||
mov r10, [rsp] ; error code
|
||||
mov r11, [rsp+8] ; saved rip
|
||||
|
||||
lea rdi, [12 * 8 * 0x14 + 30 * 2 + TRAM]
|
||||
mov dl, STYLE(RED_F, WHITE_B)
|
||||
mov rbx, isr%1_msg
|
||||
call print_string
|
||||
|
||||
mov rax, %1
|
||||
cmp rax, 14
|
||||
jne .end
|
||||
|
||||
.page_fault_exception:
|
||||
|
||||
; print cr2
|
||||
; print rip
|
||||
|
||||
lea rdi, [13 * 8 * 0x14 + 30 * 2 + TRAM]
|
||||
mov rbx, cr2_str
|
||||
mov rbx, rip_str
|
||||
call print_string
|
||||
|
||||
lea rdi, [13 * 8 * 0x14 + 35 * 2 + TRAM]
|
||||
mov r8, cr2
|
||||
lea rdi, [13* 8 * 0x14 + 35 * 2 + TRAM]
|
||||
mov r8, r11
|
||||
call print_int
|
||||
|
||||
; print rsp
|
||||
@ -80,14 +74,22 @@ _isr%1:
|
||||
mov r8, rsp
|
||||
call print_int
|
||||
|
||||
; print rip
|
||||
; More informations for some specific exceptions
|
||||
|
||||
mov rax, %1
|
||||
cmp rax, 14
|
||||
jne .end
|
||||
|
||||
.page_fault_exception:
|
||||
|
||||
; print cr2
|
||||
|
||||
lea rdi, [15 * 8 * 0x14 + 30 * 2 + TRAM]
|
||||
mov rbx, rip_str
|
||||
mov rbx, cr2_str
|
||||
call print_string
|
||||
|
||||
lea rdi, [15* 8 * 0x14 + 35 * 2 + TRAM]
|
||||
mov r8, r11
|
||||
lea rdi, [15 * 8 * 0x14 + 35 * 2 + TRAM]
|
||||
mov r8, cr2
|
||||
call print_int
|
||||
|
||||
; print error code
|
||||
@ -112,15 +114,33 @@ _irq%1:
|
||||
; Disable interruptions to avoid being interrupted
|
||||
cli
|
||||
|
||||
push rax
|
||||
|
||||
mov rax, [irq_handlers + 8 *%1]
|
||||
|
||||
; If there are no handler, just send EOI
|
||||
test rax, rax
|
||||
je .eoi
|
||||
|
||||
push rbx
|
||||
push rcx
|
||||
push rdx
|
||||
push rsi
|
||||
push rdi
|
||||
push r8
|
||||
push r9
|
||||
|
||||
; Call the handler
|
||||
call rax
|
||||
|
||||
push r9
|
||||
push r8
|
||||
pop rdi
|
||||
pop rsi
|
||||
pop rdx
|
||||
pop rcx
|
||||
pop rbx
|
||||
|
||||
.eoi:
|
||||
|
||||
mov rax, %1 ; IRQ number
|
||||
@ -138,6 +158,8 @@ _irq%1:
|
||||
mov al, 0x20
|
||||
out 0x20, al
|
||||
|
||||
pop rax
|
||||
|
||||
iretq
|
||||
%endmacro
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user