rust-osdev / rust-osdev/bootloader
BIOS stage 2 subtract overflows
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1.7k
- Forks
- 240
- PR merge metrics
- No merged PRs in 30d
Description
I'm attempting to migrate my kernel from v0.10.x of bootloader, and after switching to v0.11.x and running in QEMU, I see a panic in the BIOS bootloader's stage 2 code:

The subtract that overflows appears to be on this line: https://github.com/rust-osdev/bootloader/blob/fa87d01a4a166b51412d162c8343bc2565bdbee0/bios/stage-2/src/fat.rs#L96-L99
I'm creating the image using BiosBoot::create_disk_image, and passing it to QEMU with the arguments -drive format=raw,file=/path/to/bios.img as suggested in the documentation on creating a disk image, so I don't think anything about my configuration is particularly out of the ordinary. I can provide additional information if there's anything that would help, though.
Bootloader version: 0.11.2
QEMU version:
$ qemu-system-x86_64 --version
QEMU emulator version 7.2.0
Copyright (c) 2003-2022 Fabrice Bellard and the QEMU Project developers
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in bios/stage-2/src/fat.rs at lines 96-99 and reproduce the panic with BiosBoot::create_disk_image and QEMU using the documented raw-drive arguments. Compare the behavior between bootloader 0.10.x and 0.11.2, then verify that the generated BIOS image boots in QEMU without the stage 2 subtraction overflow.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100