From b0bd4b27b02ccad15e2f05d1705a900a71e20572 Mon Sep 17 00:00:00 2001 From: Elaina Claus Date: Fri, 5 Sep 2025 16:48:24 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=89=20simple=20allocator=20init=20in?= =?UTF-8?q?=20the=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/util/arena_alloc.nasm | 3 ++- src/stage2/stage2.nasm | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/util/arena_alloc.nasm b/include/util/arena_alloc.nasm index 8ebbf38..43901fa 100644 --- a/include/util/arena_alloc.nasm +++ b/include/util/arena_alloc.nasm @@ -18,12 +18,13 @@ arena_init: mov di, ax xor eax, eax - mov word [di + ArenaStateStruc_t.mark], eax + mov word [di + ArenaStateStruc_t.mark], ax mov word [di + ArenaStateStruc_t.end], word (__ARENA_HEAP_START + __ARENA_HEAP_SIZE) mov word [di + ArenaStateStruc_t.start], __ARENA_HEAP_START ; zero out heap area on init ; void* kmemset_byte(void* dst, uint8_t val, uint16_t len); + ; TODO: use word or qword spacing at least to speed this up mov ax, __ARENA_HEAP_SIZE push ax ; len xor ax, ax diff --git a/src/stage2/stage2.nasm b/src/stage2/stage2.nasm index da800bb..c0ec4dc 100755 --- a/src/stage2/stage2.nasm +++ b/src/stage2/stage2.nasm @@ -158,8 +158,10 @@ main: print_string HelloPrompt_info ; setup the early heap - push area + mov ax, early_heap_state + push ax ; address in bss of state structure call arena_init + add sp, 0x2 ; enable A20 gate call EnableA20