Move kernel libs into subdir, create NBP-specific entrypoint
This commit is contained in:
parent
c2e68a217e
commit
260db9f8d7
8
Makefile
8
Makefile
@ -1,5 +1,7 @@
|
||||
kernel.com: *.asm
|
||||
nasm -s -o kernel.com main.asm
|
||||
default: nbp.com
|
||||
|
||||
%.com: %.asm
|
||||
nasm -s -o $@ $<
|
||||
|
||||
clean:
|
||||
rm -f kernel.com
|
||||
rm -f *.com
|
||||
|
28
kernel/heap.asm
Normal file
28
kernel/heap.asm
Normal file
@ -0,0 +1,28 @@
|
||||
heap_size:
|
||||
dw 0x0100
|
||||
|
||||
heap_init:
|
||||
push ax ; byte value (0)
|
||||
push cx ; loop counter
|
||||
push di ; target ptr
|
||||
xor ax, ax
|
||||
mov cx, [heap_size]
|
||||
mov di, heap
|
||||
rep stosb ; rep makes this loop cx times, incrementing di, writing al
|
||||
pop di
|
||||
pop cx
|
||||
pop ax
|
||||
ret
|
||||
|
||||
; in ax number of bytes to alloc
|
||||
; out ds:di
|
||||
malloc:
|
||||
push dx ; length of block index
|
||||
or ax,0x0F
|
||||
inc ax
|
||||
mov dx, 0x100
|
||||
mov bp, heap
|
||||
|
||||
int 0x2E
|
||||
pop dx
|
||||
ret
|
@ -1,6 +1,6 @@
|
||||
; assumptions about the starting envionment
|
||||
cpu 8086
|
||||
org 0x0000 ; if we are not at CS:0000, CS adjustment will fix it for us
|
||||
org 0x0000
|
||||
; dl probable drive number
|
||||
; ds:si probable pointer to partition structure
|
||||
; es:bx probable pxeenv+ structure
|
||||
@ -42,28 +42,24 @@ _exit:
|
||||
main:
|
||||
mov ax, cs
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
|
||||
mov bx, 0x002E
|
||||
mov dx, debug_reg_ir
|
||||
|
||||
call ivt_set
|
||||
|
||||
mov ax, 0
|
||||
mov bx, 0
|
||||
call cons
|
||||
mov si, di
|
||||
call print
|
||||
call heap_init
|
||||
mov ax, 18
|
||||
call malloc
|
||||
|
||||
ret
|
||||
|
||||
%include "intr.asm"
|
||||
%include "debug.asm"
|
||||
%include "kprintf.asm"
|
||||
%include "heap.asm"
|
||||
|
||||
%include "cons.asm"
|
||||
%include "int.asm"
|
||||
%include "print.asm"
|
||||
%include "kernel/heap.asm"
|
||||
%include "kernel/intr.asm"
|
||||
%include "kernel/debug.asm"
|
||||
%include "kernel/kprintf.asm"
|
||||
|
||||
align 16
|
||||
heap:
|
||||
dw 0
|
4
run.sh
4
run.sh
@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
exec qemu-system-x86_64 -boot n \
|
||||
exec qemu-system-x86_64 -boot n -fda fd0.img \
|
||||
-option-rom /usr/share/qemu/pxe-rtl8139.rom \
|
||||
-device e1000,netdev=mynet0,mac=52:54:00:12:34:56 \
|
||||
-netdev user,id=mynet0,net=192.168.76.0/24,dhcpstart=192.168.76.9,tftp=$PWD,bootfile=kernel.com
|
||||
-netdev user,id=mynet0,net=192.168.76.0/24,dhcpstart=192.168.76.9,tftp=$PWD,bootfile=nbp.com
|
||||
|
Loading…
Reference in New Issue
Block a user