1
1
Fork 0

did simplify multiboot header because loader may not be trusted

This commit is contained in:
Lauren Toivanen 2025-12-04 03:35:07 +02:00
parent 19e7844aa5
commit 5d71436c30
2 changed files with 21 additions and 29 deletions

View file

@ -2,35 +2,27 @@ format binary
use32
org 0x100000
MB_HEADER_MAGIC equ 0x1BADB002
MB_PAGE_ALIGN equ (1 shl 0)
MB_MEMORY_INFO equ (1 shl 1)
MB_VIDEO_REQUEST equ (1 shl 2)
MB_AOUT_KLUDGE equ (1 shl 16)
MB_HEADER_FLAGS equ MB_PAGE_ALIGN or MB_MEMORY_INFO or MB_VIDEO_REQUEST
MB_HEADER_FLAGS equ MB_PAGE_ALIGN or MB_MEMORY_INFO or MB_VIDEO_REQUEST or MB_AOUT_KLUDGE
MB_CHECKSUM equ -(MB_HEADER_MAGIC + MB_HEADER_FLAGS)
;; safe modes according to https://wiki.osdev.org/VESA_Video_Modes
VWIDTH equ 80 ; 640/720
VHEIGHT equ 25 ; 480
VDEPTH equ 0 ; 24/32, zero in textmode
; multiboot skips us to 32bit mode
; 16bit mode required to set video mode
; multiboot might not set our video mode (looking at you, syslinux!)
; TODO: make the own bootloader and ditch multiboot
; users can(will) have inexpensive small harddrives or usbs dedicated to this shit
multiboot:
dd MB_HEADER_MAGIC
dd MB_HEADER_FLAGS
dd MB_CHECKSUM
dd multiboot ; header address
dd 0x100000 ; load address
dd bss_start ; load end address
dd bss_end ; bss end address
dd start ; entry address
dd 1 ; video mode_type (0:fb, 1:txt) (set flags[2]!)
dd VWIDTH ; video width
dd VHEIGHT ; video height
dd VDEPTH ; video depth
dd 0x1BADB002 ; magic
dd 00000000000000010000000000000000b ; aout kludge flag
dd 0xE4514FFE ; mboot checksum
dd 0x100000 ; header address
dd 0x100000 ; load address
dd 0 ; load end address, 0=assume whole file
dd 0 ; bss end address, 0=don't zero-init
dd 0x100030 ; entry address
; we don't ask for video mode really as it's too unreliable
; but here's it zeroed-out anyway
dd 0 ; videomode 0=linear 1=ega text
dd 0 ; width 0=no pref
dd 0 ; height 0=no pref
dd 0 ; depth 0=no pref
start:
; Setup stack
mov ebp, stack_top