Add free_sector

This commit is contained in:
Nero 2019-08-31 12:00:33 +00:00
parent ffe6eb0904
commit abe7d1c5f4
1 changed files with 11 additions and 0 deletions

View File

@ -128,6 +128,7 @@ free:
ret
; Allocate a sector, 512 bytes or 32 paragraphs
; OUT BX ptr to sector
malloc_sector:
call malloc_get_table
mov cx, 0x0200
@ -152,6 +153,16 @@ malloc_sector:
xchg bx, di
ret
; Free a sector
; IN BX ptr to sector
free_sector:
call malloc_calc_offsets
xor ax, ax
add di, bx
stosw
stosw
ret
fatal_oom:
call printf
db "PANIC OOM", 0x0A, 0x0D, 0x00