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

@ -1,10 +1,10 @@
# rOSka # rOSka
- Probably useless hobby OS project - Probably useless hobby OS project
- Targets 32bit legacy systems with graphical framebuffer - Targets 32bit legacy systems with graphical framebuffer (VESA VBE 2)
- Boots with multiboot compatible bootloader, such as GRUB - Boots with multiboot compatible bootloader, such as GRUB
- Assembles with FASM - Assembles with FASM
- We'll probably use ext2 filesystem - We'll probably use ext2/4 filesystem
## GRUB disk creation ## GRUB disk creation

View file

@ -2,35 +2,27 @@ format binary
use32 use32
org 0x100000 org 0x100000
MB_HEADER_MAGIC equ 0x1BADB002 ; multiboot skips us to 32bit mode
MB_PAGE_ALIGN equ (1 shl 0) ; 16bit mode required to set video mode
MB_MEMORY_INFO equ (1 shl 1) ; multiboot might not set our video mode (looking at you, syslinux!)
MB_VIDEO_REQUEST equ (1 shl 2) ; TODO: make the own bootloader and ditch multiboot
MB_AOUT_KLUDGE equ (1 shl 16) ; users can(will) have inexpensive small harddrives or usbs dedicated to this shit
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: multiboot:
dd MB_HEADER_MAGIC dd 0x1BADB002 ; magic
dd MB_HEADER_FLAGS dd 00000000000000010000000000000000b ; aout kludge flag
dd MB_CHECKSUM dd 0xE4514FFE ; mboot checksum
dd multiboot ; header address dd 0x100000 ; header address
dd 0x100000 ; load address dd 0x100000 ; load address
dd bss_start ; load end address dd 0 ; load end address, 0=assume whole file
dd bss_end ; bss end address dd 0 ; bss end address, 0=don't zero-init
dd start ; entry address dd 0x100030 ; 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
; 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: start:
; Setup stack ; Setup stack
mov ebp, stack_top mov ebp, stack_top