kernel: wip

This commit is contained in:
Nero 2019-03-31 20:54:51 +00:00
parent 59f769d530
commit fa6e624604
2 changed files with 46 additions and 21 deletions

View File

@ -1,23 +1,15 @@
; out ds:si copy of interrupt table
ivt_backup: ivt_backup:
push ax
push cx
push di ; backup original value
push ds push ds
mov ax, 0x80 push es
call malloc xor ax, ax
push di mov ds, ax
mov cx, 0x80
mov ax, cs
mov es, ax mov es, ax
mov si, 0x0000 mov si, ax
mov ds, si mov di, 0x0100 ; int 0x40 address
rep movsb mov cx, 0x0040 ; 0x20 interrupts * 2 words
pop si ; this was di after malloc repe movsw
pop es
pop ds pop ds
pop di ; restore original di
pop cx
pop ax
ret ret
; set item in interrupt vector table ; set item in interrupt vector table
@ -34,7 +26,7 @@ ivt_set:
sal bx,1 sal bx,1
mov [es:bx], dx mov [es:bx], dx
mov [es:bx+2], ds mov [es:bx+2], cs
pop ax pop ax
pop es pop es

View File

@ -4,18 +4,51 @@ org 0x0000
_startup: _startup:
mov ax, cs mov ax, cs
mov ds, ax
mov es, ax
mov ss, ax mov ss, ax
mov sp, 0x0000 mov sp, 0x0000
main: main:
mov ax, cs xor ax, ax
mov ds, ax mov ds, ax
mov si, ax
mov cx, ax
call heap_init
call ivt_backup
call debug_init call debug_init
int 0x2E int 0x2E
call ivt_backup
xor ax, ax
mov ds, ax
mov es, ax
xor cx, cx
mov si, ax
.loop:
mov ax, cx
call kprint8
mov al, '='
call kputc
lodsw
xchg ax, dx
lodsw
call kprint16
mov al, ':'
call kputc
xchg ax, dx
call kprint16
mov al, ' '
call kputc
inc cx
test cx, 0x0003
jnz .loop
mov al, 0x0A
call kputc
mov al, 0x0D
call kputc
cmp cx, 0x0060
jl .loop
.halt: .halt:
hlt hlt
jmp .halt jmp .halt