You are browsing as a guest. Sign up (or log in) to start making projects!

1h 13m 5s logged

I rewrote the bootloader into two stages.
Each item in stage 2 is
Disk loader: disk_read_lba in stage2 is fully reusable (LBA, count, drive, destination segment:offset via a Disk Address Packet), checks for INT 13h extensions first, and retries 3 times with a disk reset between attempts, same pattern in stage1’s simpler loader.
Print routine: print_string prints status lines at each stage (“loading kernel…”, “enabling A20…”, etc) plus explicit disk error and unsupported extensions messages.
A20: now enabled in real mode before the protected mode switch, using the BIOS function and the fast A20 gate together.
Boot drive: saved from DL at both stage1 and stage2 entry rather than hardcoded.
Magic numbers: sector counts, load addresses, and buffer addresses all moved into src/config.inc, shared by both stages.
E820 memory map: collected in real mode into a fixed buffer before switching to protected mode.
Boot info struct: built in 32-bit mode and handed to the kernel via EBX. Matching BootInfo struct is in kernel.h.
Load/execute address mismatch: The kernel now loads to physical 0x10000 in real mode, then once in flat 32-bit protected mode, stage2 copies it to 0x100000 with rep movsd before jumping there, so the linker script’s link address and the actual jump target now agree.

0
4

Comments 0

No comments yet. Be the first!