From 85cc696ea5120982072cd5d3ef7dfd757088a7e9 Mon Sep 17 00:00:00 2001 From: Lizzy Fleckenstein Date: Thu, 7 Dec 2023 15:33:24 +0100 Subject: ensure stack doesn't overwrite MBR during stage1 --- stage1/main.asm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/stage1/main.asm b/stage1/main.asm index ce4ead4..f14c1f0 100644 --- a/stage1/main.asm +++ b/stage1/main.asm @@ -13,7 +13,7 @@ boot: mov ss, ax ; init stack - mov bp, KSTART ; stack grows down, overwriting MBR + mov bp, 0x7C00 mov sp, bp ; print message @@ -30,6 +30,10 @@ boot: ; load stage2 and stage3 call load_stages + ; reclaim MBR space for stack + mov bp, KSTART + mov sp, bp + ; jump into stage2 jmp KSTART -- cgit v1.2.3