From abe7d1c5f4ecbfa05dc41b3a7d603086a9f4f4da Mon Sep 17 00:00:00 2001 From: Ain <41307858+nero@users.noreply.github.com> Date: Sat, 31 Aug 2019 12:00:33 +0000 Subject: [PATCH] Add free_sector --- kernel/malloc.asm | 11 +++++++++++ 1 file changed, 11 insertions(+) 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