Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BIOS stage 2 subtract overflows #354

Open
hawkw opened this issue Mar 16, 2023 · 2 comments
Open

BIOS stage 2 subtract overflows #354

hawkw opened this issue Mar 16, 2023 · 2 comments

Comments

@hawkw
Copy link
Contributor

hawkw commented Mar 16, 2023

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:
image

The subtract that overflows appears to be on this line:

let data_sectors = total_sectors
- (self.reserved_sector_count as u32
+ (self.num_fats as u32 * self.fat_size_in_sectors())
+ root_dir_sectors);

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
@phil-opp
Copy link
Member

Thanks for reporting! I'm not sure what's going wrong here yet. Do you have your code online somewhere so that I can do some debugging?

@hawkw
Copy link
Contributor Author

hawkw commented Mar 17, 2023

@phil-opp The branch updating my OS to use bootloader v0.11.2 is here: hawkw/mycelium#406

Unfortunately, it's definitely not a minimal reproduction of the crash. I did try running the tests in the bootloader repo on my machine with the same version of QEMU, and they all passed for me. So, it seems like something about my code is required to reproduce this...I'm just not sure what. Happy to keep debugging if there's anything I can do to help.

hawkw added a commit to hawkw/mycelium that referenced this issue Apr 5, 2023
Currently, booting using legacy BIOS doesn't work for us after updating
to `bootloader` v0.11.x (see rust-osdev/bootloader#354). Also, booting
using UEFI is significantly nicer --- it gets us a better memory map and
a bigger framebuffer, among other things.

This commit changes `inoculate` to build a UEFI boot image by default,
rather than defaulting to legacy BIOS.
hawkw added a commit to hawkw/mycelium that referenced this issue Apr 5, 2023
Currently, booting using legacy BIOS doesn't work for us after updating
to `bootloader` v0.11.x (see rust-osdev/bootloader#354). Also, booting
using UEFI is significantly nicer --- it gets us a better memory map and
a bigger framebuffer, among other things.

This commit changes `inoculate` to build a UEFI boot image by default,
rather than defaulting to legacy BIOS.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants