Compare commits
2 commits
180c1254e6
...
90e1d2818d
Author | SHA1 | Date | |
---|---|---|---|
d0p1 🏳️⚧️ | 90e1d2818d | ||
d0p1 🏳️⚧️ | 8081e804a5 |
|
@ -9,7 +9,9 @@ SRCS = kernel.asm \
|
|||
dev/vga_console.inc \
|
||||
mm/mm.inc \
|
||||
mm/pmm.inc \
|
||||
lock.inc
|
||||
lock.inc \
|
||||
gdt.inc \
|
||||
isr.inc
|
||||
|
||||
.PHONY: all
|
||||
all: $(KERNEL)
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
macro ISR [name,error] {
|
||||
isr_table:
|
||||
forward
|
||||
dd isr_#name
|
||||
forward
|
||||
|
@ -13,6 +12,34 @@ 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:
|
||||
pusha
|
||||
|
||||
|
@ -25,6 +52,9 @@ isr_common:
|
|||
mov fs, ax
|
||||
mov gs, ax
|
||||
|
||||
mov esi, szMsgInterrupt
|
||||
call klog
|
||||
|
||||
pop eax
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
|
@ -36,6 +66,7 @@ isr_common:
|
|||
sti
|
||||
iret
|
||||
|
||||
aISRTable:
|
||||
ISR \
|
||||
division_by_zero, 0, \
|
||||
debug, 0, \
|
||||
|
@ -69,3 +100,5 @@ ISR \
|
|||
reserved29, 0, \
|
||||
security_exception, 0, \
|
||||
reserved31, 0
|
||||
|
||||
szMsgInterrupt db "Interrupt", 0
|
||||
|
|
|
@ -56,6 +56,7 @@ kmain:
|
|||
lgdt [pGDT]
|
||||
; I don't think i need to reload segment cuz their value are already correct
|
||||
|
||||
call idt_setup
|
||||
|
||||
|
||||
.halt:
|
||||
|
@ -73,6 +74,7 @@ kmain:
|
|||
include 'mm/mm.inc'
|
||||
include 'lock.inc'
|
||||
include 'gdt.inc'
|
||||
include 'isr.inc'
|
||||
|
||||
szMsgKernelAlive db "Kernel is alive", 0
|
||||
szErrorBootProtocol db "Error: wrong magic number", 0
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
;; File: pic.inc
|
||||
;; <Datasheet at https://pdos.csail.mit.edu/6.828/2005/readings/hardware/8259A.pdf>
|
||||
|
||||
PIC1_COMMAND = 0x20
|
||||
PIC1_DATA = 0x21
|
||||
PIC2_COMMAND = 0xA0
|
||||
|
|
|
@ -102,6 +102,7 @@ struc idt_gate
|
|||
.attributes: resb 1
|
||||
.offset_high: resw 1
|
||||
endstruc
|
||||
defn idt_gate
|
||||
|
||||
;; About: Gates
|
||||
;; - Task Gate
|
||||
|
|
1318
share/docs/manifesto.texi
Normal file
1318
share/docs/manifesto.texi
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue