fix: 🐛 Use inline(always) to optimize code

This removes additional dummy jumps.
This commit is contained in:
Berkus Decker 2021-12-26 17:16:53 +02:00
parent 162592beaa
commit a95d4e3fb0
3 changed files with 4 additions and 0 deletions

View File

@ -62,6 +62,7 @@ pub unsafe extern "C" fn _start() -> ! {
///
/// The function is called from the assembly `_start` function, keep it to support "asm" feature.
#[no_mangle]
#[inline(always)]
pub unsafe fn _start_rust(max_kernel_size: u64) -> ! {
crate::kernel_init(max_kernel_size)
}

View File

@ -25,6 +25,7 @@ mod boot;
///
/// - Only a single core must be active and running this function.
/// - The init calls in this function must appear in the correct order.
#[inline(always)]
unsafe fn kernel_init(max_kernel_size: u64) -> ! {
#[cfg(feature = "jtag")]
machine::arch::jtag::wait_debugger();
@ -66,6 +67,7 @@ fn read_u64() -> u64 {
}
/// The main function running after the early init.
#[inline(always)]
fn kernel_main(max_kernel_size: u64) -> ! {
#[cfg(test)]
test_main();

View File

@ -24,6 +24,7 @@ macro_rules! entry {
/// # Safety
/// Only type-checks!
#[export_name = "main"]
#[inline(always)]
pub unsafe fn __main() -> ! {
// type check the given path
let f: fn() -> ! = $path;