Compare commits

..

No commits in common. "90e1d2818d6ecacb5bb9c25651630702e473d5a3" and "180c1254e665464059637d35719a96b935666a16" have entirely different histories.

6 changed files with 2 additions and 1361 deletions

View file

@ -9,9 +9,7 @@ SRCS = kernel.asm \
dev/vga_console.inc \ dev/vga_console.inc \
mm/mm.inc \ mm/mm.inc \
mm/pmm.inc \ mm/pmm.inc \
lock.inc \ lock.inc
gdt.inc \
isr.inc
.PHONY: all .PHONY: all
all: $(KERNEL) all: $(KERNEL)

View file

@ -1,4 +1,5 @@
macro ISR [name,error] { macro ISR [name,error] {
isr_table:
forward forward
dd isr_#name dd isr_#name
forward forward
@ -12,34 +13,6 @@ forward
} }
idt_setup:
xor ecx, ecx
@@:
mov eax, [aISRTable + (ecx * 4)]
mov [aInterruptGate + (ecx * 8)], ax
mov [aInterruptGate + (ecx * 8) + 2], word 0x08
mov [aInterruptGate + (ecx * 8) + 5], word 0x8E
shr eax, 16
mov [aInterruptGate + (ecx * 8) + 6], ax
inc ecx
cmp ecx, 32
jb @b
lidt [pIDT]
sti
ret
pIDT:
dw aInterruptGate.end-aInterruptGate-1
dd aInterruptGate
; variable: idt_entries
aInterruptGate:
dd 256*2 dup(0)
.end:
isr_common: isr_common:
pusha pusha
@ -52,9 +25,6 @@ isr_common:
mov fs, ax mov fs, ax
mov gs, ax mov gs, ax
mov esi, szMsgInterrupt
call klog
pop eax pop eax
mov ds, ax mov ds, ax
mov es, ax mov es, ax
@ -66,7 +36,6 @@ isr_common:
sti sti
iret iret
aISRTable:
ISR \ ISR \
division_by_zero, 0, \ division_by_zero, 0, \
debug, 0, \ debug, 0, \
@ -100,5 +69,3 @@ ISR \
reserved29, 0, \ reserved29, 0, \
security_exception, 0, \ security_exception, 0, \
reserved31, 0 reserved31, 0
szMsgInterrupt db "Interrupt", 0

View file

@ -56,7 +56,6 @@ kmain:
lgdt [pGDT] lgdt [pGDT]
; I don't think i need to reload segment cuz their value are already correct ; I don't think i need to reload segment cuz their value are already correct
call idt_setup
.halt: .halt:
@ -74,7 +73,6 @@ kmain:
include 'mm/mm.inc' include 'mm/mm.inc'
include 'lock.inc' include 'lock.inc'
include 'gdt.inc' include 'gdt.inc'
include 'isr.inc'
szMsgKernelAlive db "Kernel is alive", 0 szMsgKernelAlive db "Kernel is alive", 0
szErrorBootProtocol db "Error: wrong magic number", 0 szErrorBootProtocol db "Error: wrong magic number", 0

View file

@ -1,6 +1,3 @@
;; File: pic.inc
;; <Datasheet at https://pdos.csail.mit.edu/6.828/2005/readings/hardware/8259A.pdf>
PIC1_COMMAND = 0x20 PIC1_COMMAND = 0x20
PIC1_DATA = 0x21 PIC1_DATA = 0x21
PIC2_COMMAND = 0xA0 PIC2_COMMAND = 0xA0

View file

@ -102,7 +102,6 @@ struc idt_gate
.attributes: resb 1 .attributes: resb 1
.offset_high: resw 1 .offset_high: resw 1
endstruc endstruc
defn idt_gate
;; About: Gates ;; About: Gates
;; - Task Gate ;; - Task Gate

File diff suppressed because it is too large Load diff