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

layout: Support running the firmware as a BIOS image #24

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Commits on Sep 10, 2020

  1. gdt: Add definitions for 32-bit GDT

    Our 32-bit GDT just has 1 code and 1 data segment descriptor. They are
    both flat (spanning the entire 4G address space) and are placed in
    normal static memory (for now).
    
    Signed-off-by: Joe Richey <[email protected]>
    josephlr committed Sep 10, 2020
    Configuration menu
    Copy the full SHA
    a91b400 View commit details
    Browse the repository at this point in the history
  2. bios: Add code to boot as Firmware ROM

    The new assembly files handle:
      - reset.s: Jumping from reset
      - rom16.s: Transitioning to 32-bit mode
      - rom32.s: Copying data from ROM to RAM, jumping to PVH entry point
    
    To place this code correctly, we add a new Program Header for the code
    and data that expect to be in ROM. See the comments in layout.ld for
    more information.
    
    We also place the 32-bit GDT in the ROM. This is mostly for convenience,
    as it lets us use the GDT directly from the ROM code without having to
    do any complex offset calculations.
    
    As laying out the code for a ROM makes the binary ~45% bigger, we gate
    building as a ROM behind an optional feature.
    
    Signed-off-by: Joe Richey <[email protected]>
    josephlr committed Sep 10, 2020
    Configuration menu
    Copy the full SHA
    ae54aed View commit details
    Browse the repository at this point in the history
  3. bios: Make sure PVH still works with "rom" feature

    Without this change, QEMU/CloudHV will attempt to load the ROM into the
    memory region below 4GiB. But something (i.e. SeaBIOS) is already there.
    
    We just pick an arbitrary address. It doesn't actually matter where it
    gets loaded, as the ROM code isn't used when doing PVH boot.
    
    Signed-off-by: Joe Richey <[email protected]>
    josephlr committed Sep 10, 2020
    Configuration menu
    Copy the full SHA
    8961efc View commit details
    Browse the repository at this point in the history