Interrupt handler works, sort of??

Something seems to be wrong with the iret out of it
This commit is contained in:
greg
2015-11-14 22:30:27 -08:00
parent 7aa3e0c290
commit 1551bdc7b2
2 changed files with 28 additions and 8 deletions

View File

@@ -56,7 +56,7 @@ pub extern fn rust_main() {
timer = 0;
}
if count > 200 {
if count > 200 && count < 300 {
unsafe {
call_interrupt();
}

View File

@@ -22,6 +22,14 @@ long_mode_start:
hlt
spin_loop_64:
mov rcx, 0xffff_ffff
.loop:
dec rcx
cmp rcx, 0
jne spin_loop_64.loop
ret
error:
mov rbx, 0x4f4f4f524f524f45
mov [0xb8000], rbx
@@ -62,17 +70,29 @@ get_rdtsc:
ret
call_interrupt:
int 50
int 49
ret
sample_handler:
mov word [0x8b000], 0x4f72
call spin_loop_64
iret
setup_IDT:
lidt [idt64.pointer]
mov rax, sample_handler
mov [idt64 + 49*16], ax
mov word [idt64 + 49*16 +2], cs
mov word [idt64 + 49*16 + 4], 0x8e00
shr rax, 16
mov [idt64 + 49*16 + 6], ax
shr rax, 16
mov [idt64 + 49*16 + 8], ax
ret
section .rodata
idt64:
resb 50*16
.pointer:
dw .pointer - idt64
dq idt64
idt64:
resb 50*16
.pointer:
dw .pointer - idt64
dq idt64