2019-10-08 19:50:48 +00:00
|
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
//
|
|
|
|
// Copyright (c) 2018-2019 Andre Richter <andre.o.richter@gmail.com>
|
|
|
|
|
|
|
|
//! Rust runtime initialization code.
|
|
|
|
|
2019-10-17 19:49:38 +00:00
|
|
|
/// Equivalent to `crt0` or `c0` code in C/C++ world. Clears the `bss` section, then calls the
|
|
|
|
/// kernel entry.
|
2019-10-08 19:50:48 +00:00
|
|
|
///
|
|
|
|
/// Called from `BSP` code.
|
|
|
|
///
|
|
|
|
/// # Safety
|
|
|
|
///
|
|
|
|
/// - Only a single core must be active and running this function.
|
|
|
|
pub unsafe fn init() -> ! {
|
|
|
|
extern "C" {
|
2019-10-17 07:38:24 +00:00
|
|
|
// Boundaries of the .bss section, provided by the linker script.
|
2019-10-08 19:50:48 +00:00
|
|
|
static mut __bss_start: u64;
|
|
|
|
static mut __bss_end: u64;
|
|
|
|
}
|
|
|
|
|
2019-10-17 07:38:24 +00:00
|
|
|
// Zero out the .bss section.
|
2019-10-08 19:50:48 +00:00
|
|
|
r0::zero_bss(&mut __bss_start, &mut __bss_end);
|
|
|
|
|
|
|
|
crate::kernel_entry()
|
|
|
|
}
|