by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    spcan
    @spcan
    Hi, in the rewrite branch, how is it supposed to be compiled?
    When I try to compile it with bootimage it fails with this error message: Could not find required keypackages[name = bootloader`` in cargo metadata output
    spcan
    @spcan
    I have added the master branch [package.metadata.bootloader] and it fails as well
    rybot666
    @rybot666
    Rewrite does not have bootimage compatibilty of yet, it doesnt actually load a kernel either. You can compile it by running cargo xbuild in the root directory and then objcopying target/i8086-bootloader/release/bootloader to a binary
    Philipp Oppermann
    @phil-opp

    I just pushed the first prototype of the uefi bootloader here: https://github.com/rust-osdev/bootloader/tree/uefi

    Use cargo uefi-build for building and cargo uefi-run for starting it in QEMU (requires OVMF). Like the BIOS bootloader, you need to set the path to your kernel binary in the KERNEL environment variable and the path to the Cargo.toml of your kernel in the KERNEL_MANIFEST_PATH environment variable when building.

    The implementation currently only sets up a new page tables for mapping the kernel ELF file and then passes control to the kernel. No boot information is passed yet and no additional mappings (e.g. framebuffer, physical memory) are done yet.

    rybot666
    @rybot666
    Oh dear
    I have somehow created code that depends on the instructions before it
    The IDT lazy_static! gets a certain amount then just stops, based on what other stuff you put in it
    Jumps way out of the loaded area
    image.png
    rybot666
    @rybot666
    In particular it happens somewhere in formatting machinery
    Something is up with println
    rybot666
    @rybot666
    This is going to be one of those horrible bugs that make 0 sense isn't it
    Like the red zone one
    Huh that's really weird
    println! breaks for inexplicable reasons when used inside of lazy_static!
    rybot666
    @rybot666
    Double fault interrupt handler fails with an LLVM error (I think the protected mode x86-interrupt convention uses different arguments?)
    rybot666
    @rybot666
    I can't find much info on the x86-interrupt calling convention other than rust-lang/rust#40180 tracking issue for Rust and the source code on LLVM's doxygen, which doesn't have much info that I can see affecting this
    If anyone has some extra info it'd be great
    rybot666
    @rybot666
    (this is preventing me from adding anything with an error code btw, so no GPF or double fault handlers, both of which are pretty important)
    rybot666
    @rybot666
    I probably should have realised that I just needed to read the source of that slightly more
    Error codes are 32 bits in pmode
    Philipp Oppermann
    @phil-opp
    Yeah, I think you have to get the function signature exactly right, otherwise LLVM throws an error.
    I'm not sure about the lazy_static problem. Maybe it's bss related because the static is zero-initialized at compile time and only later inititalized with the real values? On the other hand, I think that converting the ELF file to a flat binary should properly zero-initialize these bss sections…
    rybot666
    @rybot666
    Update - We can now successfully switch into user & v86 mode
    The monitor is in the process of being written, then we can load the kernel into memory and prepare for long mode
    Ethin Probst
    @ethindp
    Is this for the UEFI bootloader? Or which project is this?
    rybot666
    @rybot666
    Bootloader rewrite
    Reimplemented the protected and real mode sections in rust
    Ethin Probst
    @ethindp
    Ah, nice. So less assembly, more rust?
    rybot666
    @rybot666
    Exactly
    Ethin Probst
    @ethindp
    I like that
    Ethin Probst
    @ethindp
    It'll make it easier to comprehend
    rybot666
    @rybot666
    Hopefully
    I'm going to try to write some posts similar to blog os about the steps it takes to boot up once it's finished
    I think the steps we have left are: finish v8086 mode to load the kernel into memory, set up paging and enter long mode
    rybot666
    @rybot666
    The UEFI bootloader is going to be merged into this using crate features btw
    Ethin Probst
    @ethindp
    That sounds perfect
    rybot666
    @rybot666
    The rust bootsector is small enough to fit the MBR into it aswell, which is a nice bonus
    Ethin Probst
    @ethindp
    Even better. Sounds like that code will be trivially modifiable and extensible -- which is an even nicer bonus.
    rybot666
    @rybot666
    Hopefully. It's split up into a lot of smaller subcrates for each stage so we have clear divisions
    Ethin Probst
    @ethindp
    Right. But that's nice because you can effectively have diffrent teams work on different parts. We could make it as complex or as simple as we like, with each extension a subcrate and (maybe) a feature, so you could pick and choose what you need.
    rybot666
    @rybot666
    Yeah
    We build everything together with a build script aswell, which means features can redefine entire crates if they needed to
    Ethin Probst
    @ethindp
    Yep. Which is nice.
    rybot666
    @rybot666
    Indeed
    Feel free to take a look at the source code
    It's a bit messy in some parts because debugging
    Ethin Probst
    @ethindp
    Fair