diff --git a/kernel/malloc.asm b/kernel/malloc.asm index df634cf..f451c1c 100644 --- a/kernel/malloc.asm +++ b/kernel/malloc.asm @@ -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