Remove skeleton of rom-based kernel
This commit is contained in:
parent
c604fd43e7
commit
734ab3852a
@ -1,70 +0,0 @@
|
||||
; Get pointer to interrupt vector
|
||||
; IN al number
|
||||
; OUT 0:bx ptr to vector
|
||||
intr_ptr:
|
||||
xor bh, bh
|
||||
mov bl, al
|
||||
add bx, bx
|
||||
add bx, bx
|
||||
ret
|
||||
|
||||
; Set interrupt vector
|
||||
; IN al number
|
||||
; ds:dx ptr
|
||||
intr_set:
|
||||
push bx
|
||||
call intr_ptr
|
||||
ss mov [bx], dx
|
||||
ss mov [bx+2], ds
|
||||
pop bx
|
||||
ret
|
||||
|
||||
; Get interrupt vector
|
||||
; IN al number
|
||||
; OUT es:bx ptr
|
||||
intr_get:
|
||||
call intr_ptr
|
||||
ss mov es, [bx+2]
|
||||
ss mov bx, [bx]
|
||||
ret
|
||||
|
||||
; Save BIOS vectors
|
||||
; Trashes ax, cx, bx, ds
|
||||
intr_backup:
|
||||
mov cx, 0x20
|
||||
xor bx, bx
|
||||
mov ds, bx
|
||||
.loop: ; load segment
|
||||
mov ax, [bx+2]
|
||||
; skip transfer if not pointing to BIOS
|
||||
cmp ax, 0xA000
|
||||
jc .skip
|
||||
; store segment
|
||||
mov [bx+ivt2+2], ax
|
||||
; copy offset
|
||||
mov ax, [bx]
|
||||
mov [bx+ivt2], ax
|
||||
; iterate to next vector
|
||||
.skip: add bx, 4
|
||||
loop .loop
|
||||
ret
|
||||
|
||||
; Restore BIOS vectors
|
||||
intr_restore:
|
||||
mov cx, 0x20
|
||||
xor bx, bx
|
||||
mov ds, bx
|
||||
.loop: ; load segment
|
||||
mov ax, [bx+ivt2+2]
|
||||
; skip if not a vector to BIOS
|
||||
cmp ax, 0xA000
|
||||
jc .skip
|
||||
; store segment
|
||||
mov [bx+2], ax
|
||||
; copy offset
|
||||
mov ax, [bx+ivt2]
|
||||
mov [bx], ax
|
||||
; iterate to next vector
|
||||
.skip: add bx, 4
|
||||
loop .loop
|
||||
ret
|
@ -1,68 +0,0 @@
|
||||
cpu 8086
|
||||
org 0x0000
|
||||
|
||||
db 0x55, 0xAA
|
||||
db 0x00
|
||||
jmp near init
|
||||
|
||||
times (0x18 - ($-$$)) db 0
|
||||
dw 0
|
||||
dw pnp
|
||||
|
||||
pnp: db "$PnP"
|
||||
db 1 ; version 1
|
||||
db 2 ; 2 * 16 length
|
||||
dw 0 ; offset of next header
|
||||
db 0
|
||||
db 0 ; checksum (filled by fix-rom)
|
||||
dd 0 ; device identifier
|
||||
dw 0 ; manufacturer string
|
||||
dw name ; product name string
|
||||
db 0,0,0 ; device type string
|
||||
db 0x20 ; device indicator, bit for "read cacheable" set
|
||||
dw 0 ; boot connection vector
|
||||
dw 0 ; boot disconnect vector
|
||||
dw boot ; bootstrap entry point
|
||||
dw 0 ; reserved
|
||||
|
||||
; zero for setting sreg without using reg
|
||||
zero: dw 0
|
||||
|
||||
name: db "rdos", 0
|
||||
|
||||
init: push ds
|
||||
|
||||
; DS := 0
|
||||
mov ds, [cs:zero]
|
||||
; set entry points vectors
|
||||
mov word [0x19*4], boot
|
||||
mov word [0x19*4+2], cs
|
||||
|
||||
pop ds
|
||||
retf
|
||||
|
||||
; entry point on boot, preempting disks
|
||||
; this also doubles as entry point for reboot
|
||||
boot: xor ax, ax
|
||||
mov ss, ax
|
||||
mov sp, stack
|
||||
|
||||
int 3
|
||||
|
||||
hlt: hlt
|
||||
jmp hlt
|
||||
|
||||
%include "kernel/intr.asm"
|
||||
|
||||
align 512
|
||||
|
||||
absolute 0x400
|
||||
resb (0x501 - ($-$$))
|
||||
|
||||
; copy of the first 32 interrupt vectors
|
||||
ivt2: resd 0x20
|
||||
|
||||
; 8kb stack
|
||||
alignb 2
|
||||
resw 0x2000
|
||||
stack:
|
Loading…
Reference in New Issue
Block a user