You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From https://lobste.rs/s/kaj3c2/minimal_linux_bootloader_debugging#c_ybraf4, someone (with the nick name abbeyj, thank you!) suggested that the fix is to add a adc byte [gdt.dest+5], 0 instruction where the number of bytes is written to the GDT, and indeed this diff seems to work:
diff --git i/mbr/bootloader.asm w/mbr/bootloader.asm
index 58aa030..eb3dfd5 100644
--- i/mbr/bootloader.asm+++ w/mbr/bootloader.asm@@ -119,6 +119,7 @@ read_protected_mode_kernel:
sub edx, 0xfe00 ; update the number of bytes to load
add word [gdt.dest], 0xfe00
adc byte [gdt.dest+2], 0
+ adc byte [gdt.dest+5], 0
jmp short read_protected_mode_kernel.loop
read_protected_mode_kernel_2:
@@ -186,18 +187,14 @@ do_move:
ret
error:
-
mov si, error_msg
msg_loop:
- lodsb- and al, al
jz reboot
mov ah, 0xe
mov bx, 7
int 0x10
- jmp short msg_loop
reboot:
I’ll properly remove the error function (instead making the code just reboot) to make space for the extra instruction, then add padding so that we end up at 440 bytes again.
Platform
I’m using: gokrazy/apu2c4, gokrazy/x86-64
Observed behavior
The bootloader that gokrazy is currently shipping has a limit (16 MB architecturally, 15 MB in practice) for the kernel size:
https://michael.stapelberg.ch/posts/2024-02-11-minimal-linux-bootloader-debugging-story/
Options
The text was updated successfully, but these errors were encountered: