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

fix: Leave .bss initialization of loader to firmware #256

Merged
merged 1 commit into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/arch/aarch64/link.ld
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,8 @@ SECTIONS
*(.data.*)
} :segment_rw
.bss : ALIGN(8) {
bss_start = .;
*(.bss)
*(.bss.*)
bss_end = .;
} :segment_rw
. = ALIGN(4K); /* Align to page boundary */
/***********************************************************************************************
Expand Down
2 changes: 0 additions & 2 deletions src/arch/x86_64/link.ld
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@ SECTIONS
*(.data.*)
}
.bss ALIGN(4096) : AT(ADDR(.bss)) {
bss_start = .;
*(.bss)
*(.bss.*)
}
bss_end = .;
kernel_end = .;
}
2 changes: 0 additions & 2 deletions src/arch/x86_64/link_fc.ld
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ SECTIONS
*(.data.*)
}
.bss ALIGN(4096) : AT(ADDR(.bss)) {
bss_start = .;
*(.bss)
*(.bss.*)
}
bss_end = .;
kernel_end = .;
}
15 changes: 0 additions & 15 deletions src/none.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use core::fmt::Write;
use core::mem::MaybeUninit;
use core::ptr::addr_of_mut;
use core::slice;

use hermit_entry::elf::KernelObject;
Expand All @@ -17,7 +16,6 @@ extern "C" {
/// (called from entry.asm or entry.rs)
#[no_mangle]
unsafe extern "C" fn loader_main() -> ! {
init_bss();
arch::message_output_init();
crate::log::init();

Expand All @@ -38,19 +36,6 @@ unsafe extern "C" fn loader_main() -> ! {
arch::boot_kernel(kernel_info)
}

unsafe fn init_bss() {
extern "C" {
static mut bss_start: MaybeUninit<u8>;
static mut bss_end: MaybeUninit<u8>;
}

let start_ptr = addr_of_mut!(bss_start);
let end_ptr = addr_of_mut!(bss_end);
let len = end_ptr.offset_from(start_ptr).try_into().unwrap();
let slice = slice::from_raw_parts_mut(start_ptr, len);
slice.fill(MaybeUninit::new(0));
}

#[panic_handler]
fn panic(info: &core::panic::PanicInfo<'_>) -> ! {
// We can't use `println!` or related macros, because `_print` unwraps a result and might panic again
Expand Down