summaryrefslogtreecommitdiff
path: root/src/boot
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2017-06-16 14:50:58 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2017-06-16 14:50:58 +0200
commit071a6d2c84d8c8a3557ab038b5795f4401f20838 (patch)
treef3dce6c33903b38aebe071b21cd14b883f6d3d44 /src/boot
parent7b29f7c528fc647f172ed004f729da29ef7786b9 (diff)
downloadabaos-071a6d2c84d8c8a3557ab038b5795f4401f20838.tar.gz
abaos-071a6d2c84d8c8a3557ab038b5795f4401f20838.tar.bz2
fixed the stack position to 0x2000, not 0xFFFF in real mode!
zeroing all general purpose registers after switching to protected mode
Diffstat (limited to 'src/boot')
-rw-r--r--src/boot/boot.asm14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/boot/boot.asm b/src/boot/boot.asm
index 75ad05e..0f31c9d 100644
--- a/src/boot/boot.asm
+++ b/src/boot/boot.asm
@@ -22,8 +22,11 @@
; make sure we know the location of the stack by setting it on our own
; this stack is only used in real mode in stage 1, so it's growing from
-; 0xffff down
- mov bp, 0xFFFF
+; 0x2000 down, we should really not set it above 0x7c00, as this is
+; exacly the place, where we load stage 2 and the kernel to! (was 0xffff,
+; which was a really bad idea after the kernel got bigger than roughly
+; 32k!)
+ mov bp, 0x2000
mov sp, bp
; print out some information about CPU mode and BIOS boot drive
@@ -170,6 +173,13 @@ MESSAGE_HALTED_REAL:
[bits 32]
BEGIN_PROTECTED_MODE:
+; make sure registers have known values
+ xor eax, eax
+ xor ebx, ebx
+ xor ecx, ecx
+ xor edx, edx
+ xor esi, esi
+ xor edi, edi
; we switched to protected mode
mov si, MESSAGE_PROTECTED_MODE