1000Hz PIC timer working + IDT dispatch/handler fixes

This commit is contained in:
2025-12-27 13:52:05 +01:00
parent 24d75463b8
commit 54f26c506e
9 changed files with 204 additions and 52 deletions

View File

@@ -34,22 +34,22 @@ interrupt_stub:
; executed when the interrupt happened.
; (except rsp because it will already be saved in the iret frame)
push rax
push rbx
push rcx
push rdx
push rsi
push rdi
push rsp
push rbp
push r8
push r9
push r10
push r11
push r12
push r13
push r14
push r15
push qword rax
push qword rbx
push qword rcx
push qword rdx
push qword rsi
push qword rdi
;push qword rsp
push qword rbp
push qword r8
push qword r9
push qword r10
push qword r11
push qword r12
push qword r13
push qword r14
push qword r15
; Put stack pointer as first argument of our function
mov rdi, rsp
@@ -57,22 +57,22 @@ interrupt_stub:
; What the function returns (new stack pointer) is saved in rbp
mov rsp, rax
pop r15
pop r14
pop r13
pop r12
pop r11
pop r10
pop r9
pop r8
pop rbp
pop rsp
pop rdi
pop rsi
pop rdx
pop rcx
pop rbx
pop rax
pop qword r15
pop qword r14
pop qword r13
pop qword r12
pop qword r11
pop qword r10
pop qword r9
pop qword r8
pop qword rbp
;pop qword rsp
pop qword rdi
pop qword rsi
pop qword rdx
pop qword rcx
pop qword rbx
pop qword rax
; Removing the error code and vector number so stack doesn't
; get corrupted
@@ -80,7 +80,7 @@ interrupt_stub:
; Restore ss, rsp, rflags, cs, rip of code that was executing
; before the interrupt
iret
iretq
; Vector handlers will be 16-byte aligned so that we can loop over them
; like <vector_no> * 16 to get each one's address
@@ -233,4 +233,71 @@ vector_21_handler:
push qword 21
jmp interrupt_stub
; The others are reserved (22->31) or external (32->255) interrupts
; The others are reserved (22->31) or external (32->255) interrupts
align 16
vector_22_handler:
push qword 0
push qword 22
jmp interrupt_stub
align 16
vector_23_handler:
push qword 0
push qword 23
jmp interrupt_stub
align 16
vector_24_handler:
push qword 0
push qword 24
jmp interrupt_stub
align 16
vector_25_handler:
push qword 0
push qword 25
jmp interrupt_stub
align 16
vector_26_handler:
push qword 0
push qword 26
jmp interrupt_stub
align 16
vector_27_handler:
push qword 0
push qword 27
jmp interrupt_stub
align 16
vector_28_handler:
push qword 0
push qword 28
jmp interrupt_stub
align 16
vector_29_handler:
push qword 0
push qword 29
jmp interrupt_stub
align 16
vector_30_handler:
push qword 0
push qword 30
jmp interrupt_stub
align 16
vector_31_handler:
push qword 0
push qword 31
jmp interrupt_stub
; PIT timer
align 16
vector_32_handler:
push qword 0
push qword 32
jmp interrupt_stub