Add free_sector

This commit is contained in:
Nero 2019-08-31 12:00:33 +00:00
parent ffe6eb0904
commit abe7d1c5f4

View File

@ -128,6 +128,7 @@ free:
ret ret
; Allocate a sector, 512 bytes or 32 paragraphs ; Allocate a sector, 512 bytes or 32 paragraphs
; OUT BX ptr to sector
malloc_sector: malloc_sector:
call malloc_get_table call malloc_get_table
mov cx, 0x0200 mov cx, 0x0200
@ -152,6 +153,16 @@ malloc_sector:
xchg bx, di xchg bx, di
ret 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: fatal_oom:
call printf call printf
db "PANIC OOM", 0x0A, 0x0D, 0x00 db "PANIC OOM", 0x0A, 0x0D, 0x00