Commit Graph

21 Commits

Author SHA1 Message Date
Mintsuki
ff63204fc9 stage1/decompressor: Ensure limlz streams always end on a literal token 2026-04-20 18:02:57 +02:00
Mintsuki
37701de02b build: Simplify BIOS stage1 decompressor build system
It is now a single assembly file so it can be simplified.
2026-04-19 00:35:14 +02:00
Kamila Szewczyk
9c3ead9386 decompressor: gzip/tinf -> limlz
removes external dependency on tinf by replacing the compression algorithm with a simpler, faster, smaller and more auditable fixed-width LZ77 encoding purpose-tailored to x86 code mixed with data.

before: decompressor.bin 2,492 bytes (tinf dependency) with .text 0x875 and .rodata 0x13c bytes each.
after: decompressor.bin consists only of .text, 0xe6-byte decompressor; 90.8% reduction in decompressor volume.

the dependency on gzip during compile-time is replaced by host/limlzpack.c, a Lempel-Ziv encoder in 275 SLoC that uses a suffix array matchfinder (prefix-doubling in mathcal O(n log^2 n) and Storer-Szymanski backwards parse. the fixed-width formats packets as [F][LLLL][MMM], favouring a literal-skewed distribution with F switching between one-byte and two-byte offsets (favouring recent statistics).

integrity checking is done via crc32 with the polynomial 0xEDB88320, reflected.

the effective loss in compression ratio by using a tremendously simpler and less packed with edge cases algorithm causes a compression ratio hit well below 1KB, factoring in the stub sizes.

also adds new machinery for host cc detection per review.
2026-04-19 00:29:09 +02:00
Mintsuki
b866c3fcad stage1/hdd: Fix stack imbalance on int 13h/AH=48h failure in disk read 2026-03-07 00:26:46 +01:00
Mintsuki
32375c283b stage1/hdd: Rearrange code to work around boot sector size limitation 2026-03-06 13:54:21 +01:00
Mintsuki
a390517c3f stage1/hdd: Fix 64-bit LBA calculation and carry propagation in disk read loop 2026-03-06 13:11:53 +01:00
Mintsuki
7b6ad6294f stage1/hdd: Zero-extend bytes_per_sect to full EBP to fix 32-bit division 2026-02-09 13:02:39 +01:00
Mintsuki
95127304d1 host/limine; stage1/hdd: Remove logic to divide stage2 code in two
This is no longer needed since we do not support GPT embedding anymore.
2025-10-03 10:13:49 +02:00
mintsuki
68f82c3d30 stage1/gdt: Mark accessed flag in descriptors 2023-09-09 10:08:44 -05:00
mintsuki
c50e02ec2e stage1: Improve compatibility of HDD bootsector 2022-07-13 20:17:34 +02:00
mintsuki
564044ec36 stage1: Fix sector loading asm bug 2022-06-12 23:44:43 +02:00
mintsuki
400202d926 misc: stage23 -> common 2022-02-03 10:38:43 +01:00
mintsuki
3bb70dcbee build: Move to using autoconf 2022-01-16 06:09:36 +01:00
mintsuki
eaef49b78b build: Allow out of tree builds 2021-11-20 08:32:06 +01:00
mintsuki
5e023bce3d stage1: Misc improvements 2021-09-21 14:39:43 +02:00
mintsuki
3790d26194 bootsect: Also handle if boot drive is above 0x8f and gracefully fail if that's the case 2021-05-23 04:15:36 +02:00
mintsuki
d67ce23b77 stage1: hdd bootsect: Properly guard against image being booted as floppy drive 2021-05-20 23:19:24 +02:00
mintsuki
a8626d6fdd misc: Initial Makefile rework 2021-03-08 00:50:23 +01:00
mintsuki
5dc8f48d6c limine-install: Make sure stage 2 chunks are sector aligned 2021-03-04 12:40:27 +01:00
JlXip
7677c6109d iso9660: back to stage2+decompressor 2021-02-25 03:34:23 +01:00
mintsuki
27848fc85c misc: General code reorganisation 2021-02-25 01:24:54 +01:00