From aec0218ccf928caf037a34161d1d42ff7a19ee55 Mon Sep 17 00:00:00 2001 From: Ain <41307858+nero@users.noreply.github.com> Date: Fri, 30 Aug 2019 21:48:39 +0000 Subject: [PATCH] Mark reserved memory ranges as allocated on start --- kernel/malloc.asm | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/kernel/malloc.asm b/kernel/malloc.asm index fe34e04..2f70a91 100644 --- a/kernel/malloc.asm +++ b/kernel/malloc.asm @@ -1,11 +1,34 @@ ; 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: xor ax, ax mov es, ax call malloc_get_table mov cx, 0x100 ; 256 words 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 ; Input: