summaryrefslogtreecommitdiff
path: root/stage1/main.asm
diff options
context:
space:
mode:
authorLizzy Fleckenstein <eliasfleckenstein@web.de>2023-12-07 15:33:24 +0100
committerLizzy Fleckenstein <eliasfleckenstein@web.de>2023-12-07 15:33:24 +0100
commit85cc696ea5120982072cd5d3ef7dfd757088a7e9 (patch)
tree004d47f5ecd7189cd4fdb462cf638ebd4bf865c6 /stage1/main.asm
parent5f05ff8f7bc41bfeed0887f224d43d3abf0d5c75 (diff)
downloadcuddles-85cc696ea5120982072cd5d3ef7dfd757088a7e9.tar.xz
ensure stack doesn't overwrite MBR during stage1
Diffstat (limited to 'stage1/main.asm')
-rw-r--r--stage1/main.asm6
1 files changed, 5 insertions, 1 deletions
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