aboutsummaryrefslogtreecommitdiffstats
path: root/src/boot/boot.stage2.asm
diff options
context:
space:
mode:
authorkotorifan <kotorifan05@gmail.com>2026-02-03 22:50:32 +0100
committerkotorifan <kotorifan05@gmail.com>2026-02-04 09:01:10 +0100
commit8a0ab6de92c0e2b4260d6a149c43c58d004d74d9 (patch)
treeb1bfdc5d119dd01e6c603ddcb40b922e672b6c24 /src/boot/boot.stage2.asm
parent7ce57a428f4c85771582c7f486c3553cacf80c15 (diff)
downloadkotori-os-8a0ab6de92c0e2b4260d6a149c43c58d004d74d9.tar.gz
Added common.asm
Diffstat (limited to 'src/boot/boot.stage2.asm')
-rw-r--r--src/boot/boot.stage2.asm48
1 files changed, 38 insertions, 10 deletions
diff --git a/src/boot/boot.stage2.asm b/src/boot/boot.stage2.asm
index 759b784..52c73e5 100644
--- a/src/boot/boot.stage2.asm
+++ b/src/boot/boot.stage2.asm
@@ -1,19 +1,47 @@
;; boot.stage2.asm
[bits 16]
-
- %include "boot.stage2.a20.asm"
- %include "boot.stage2.pm.asm"
- %include "boot.stage1.print.asm"
-
-section .stage2
+ [org 0x7e00]
+
+ jmp 0x0000:_s2_entry
_s2_entry:
- mov si, boot_stage2_msg
+ cli
+ xor ax, ax
+ mov ds, ax
+
+ mov si, boot_s2_msg
call _print_string
- call _enable_a20
- call _enable_pm
+
+ call _enable_a20 ; Enable A20 line
+ lgdt [GDT32_ptr] ; Load GDT
+
+ ;; Setup Protected Mode
+ mov eax, cr0
+ or eax, 1
+ mov cr0, eax
+
+ jmp CODE_SEG32:_protected_mode
+
[bits 32]
+_protected_mode:
+ mov ax, DATA_SEG32
+ mov ds, ax
+ mov esp, 0x90000
+
+ mov esi, boot_protmode_msg
+ call _print_string_pm_vga
+ call 0x10000
+
+ jmp $
+
+ %include "boot.stage1.print.asm"
+ %include "boot.stage2.a20.asm"
+ %include "boot.stage2.gdt32.asm"
+ %include "boot.stage2.print.asm"
-boot_stage2_msg: db "Entering Stage 2", 13, 10, 0
+boot_s2_msg:
+ db "Entering Stage 2", 13, 10, 0
+boot_protmode_msg:
+ db "Enabling Protected Mode", 13, 10, 0