From 137735431a116018d3819356ca41f4dc9c7a56c6 Mon Sep 17 00:00:00 2001 From: Elaina Claus Date: Thu, 18 Sep 2025 19:16:27 -0400 Subject: [PATCH] move stack after bss padding --- src/stage2/stage2.nasm | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/stage2/stage2.nasm b/src/stage2/stage2.nasm index 31dd799..a002c9f 100755 --- a/src/stage2/stage2.nasm +++ b/src/stage2/stage2.nasm @@ -453,17 +453,19 @@ align 16, resb 1 %define BIOSMemoryMap_SIZE 1024 BIOSMemoryMap: resb BIOSMemoryMap_SIZE - -align 16, resb 1 -stack_bottom: - resb 2048 -stack_top: end_bss: +; !!! End bss data !!! +%define STACK_SIZE 0x1000 ; 4 KiB ; Pad to the cap (emits nothing in the file; only increases .bss virtual size). ; If BSS_SIZE > BSS_MAX_BYTES, this becomes negative and NASM errors out. -%define BSS_MAX_BYTES 0x2000 +%define BSS_MAX_BYTES (0x2000 - STACK_SIZE) resb (BSS_MAX_BYTES - (end_bss - begin_bss)) +align 16, resb 1 +stack_bottom: + resb STACK_SIZE +stack_top: + ; Optional: keep a label for later math: bss_cap_end: \ No newline at end of file