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-20 12:42:59 +00:00
|
|
|
/// Equivalent to `crt0` or `c0` code in C/C++ world. Clears the `bss` section, then jumps to kernel
|
|
|
|
/// init code.
|
2019-10-08 19:50:48 +00:00
|
|
|
///
|
|
|
|
/// # 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);
|
|
|
|
|
2019-10-20 12:42:59 +00:00
|
|
|
crate::kernel_init()
|
2019-10-08 19:50:48 +00:00
|
|
|
}
|