-
Notifications
You must be signed in to change notification settings - Fork 59
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
Cleanup attributes, macros, and memory layout #23
Conversation
The vast majority of these are not needed. This also makes it easier to: - Add code - Tell which sections actually are testing-dependent
This makes it harder to forget to append "\n" to log statments. efi::console is also modified to take the lock outside of the loop. Signed-off-by: Joe Richey <joerichey@google.com>
The pml2 tables and stack are now explictly allocated about 1 MiB. Signed-off-by: Joe Richey <joerichey@google.com>
This allows us to define all of our long-mode assembly in a separate file, making maintaince easier. Signed-off-by: Joe Richey <joerichey@google.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good but the build has failed...
src/main.rs
Outdated
} | ||
|
||
#[cfg(not(test))] | ||
/// Setup page tables to provide an identity mapping over the full 4GiB range | ||
fn setup_pagetables() { | ||
const ADDRESS_SPACE_GIB: u64 = 64; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, we don't need this to be 64 for Cloud Hypervisor any more (4GiB is sufficient)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! I'll change it to 4, do you know why it needed to be 4GiB?
Interesting it builds fine locally for me :-) |
It turns out we don't need MMIO devices above 4 GiB. Signed-off-by: Joe Richey <joerichey@google.com>
The asm files use symbols in layout.ld, which won't exsist when tests are run on the host (as it uses the host's linker script). This isn't an issue for Rust code, as we have LTO enabled. Signed-off-by: Joe Richey <joerichey@google.com>
So the build failure is simply a weird way of saying The reason it worked locally for you (and for me) it that newer versions of Note that this doesn't happen with Rust code as we always have @rbradford the CI is now green, so this should be good to merge. |
We can just get the address_space_gib symbol from the linker, which lets us avoid the need for a separate ADDRESS_SPACE_GIB constant. Signed-off-by: Joe Richey <joerichey@google.com>
@rbradford I also added 12c1679 which gets |
Logging to serial outputs on all panics significantly increases code size. We add two (on by default) features to disable serial logging: - Everywhere - Just in panics Signed-off-by: Joe Richey <joerichey@google.com>
@rbradford I noticed adding serial logging on panics, while useful for debugging, make the binary much bigger. So I added 0669ebe to allow disabling of serial logging. Binary sizes (release build, in bytes):
Does this feature gating seem worth it or reasonable? Note that serial logging and panic logging are enabled by default. |
This is absolutely fine for now. However long term I think we will need to draw a distinction between logging for the firmware (which could/should go to I/O port 0x402 like QEMU and OVMF) and output that is from the bootloader (i.e. via the EFI stdout.) The latter case should always be shown. |
This was embedded in PR #25 so can now be closed. |
This PR makes a number of cleanups to the code:
#[cfg(not(test))]
attributes are removed#![cfg_attr(test, allow(dead_code))]
log!
macro now always appends a newline.log!
on panic (so we can figure out what the panic is).asm/ram64.s
file.ram64_start
is now in this file.halt_loop
layout.ld
file.setup_pagetables()
now usesextern
arrays withMemoryRegion::from_slice
Signed-off-by: Joe Richey joerichey@google.com