Mark reserved memory ranges as allocated on start

This commit is contained in:
Nero 2019-08-30 21:48:39 +00:00
parent 9443996f56
commit aec0218ccf

View File

@ -1,11 +1,34 @@
; All these functions assume DS=0 ; All these functions assume DS=0
malloc_reserve_16:
push bx
call malloc_mark_allocated
pop bx
add bx, 0x10
loop malloc_reserve_16
ret
malloc_reset: malloc_reset:
xor ax, ax xor ax, ax
mov es, ax mov es, ax
call malloc_get_table call malloc_get_table
mov cx, 0x100 ; 256 words mov cx, 0x100 ; 256 words
rep stosw rep stosw
; reserve IVT and BDA
xor bx, bx
mov cx, 0x50
call malloc_reserve_16
; reserve malloc table itself
mov bx, 0x0600
mov cx, 0x20
call malloc_reserve_16
; reserve location for chainloaded boot sector
mov bx, 0x7C00
mov cx, 0x20
call malloc_reserve_16
ret ret
; Input: ; Input: