fix: 🐛 Use inline(always) to optimize code
This removes additional dummy jumps.
This commit is contained in:
parent
162592beaa
commit
a95d4e3fb0
|
@ -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.
|
/// The function is called from the assembly `_start` function, keep it to support "asm" feature.
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
|
#[inline(always)]
|
||||||
pub unsafe fn _start_rust(max_kernel_size: u64) -> ! {
|
pub unsafe fn _start_rust(max_kernel_size: u64) -> ! {
|
||||||
crate::kernel_init(max_kernel_size)
|
crate::kernel_init(max_kernel_size)
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ mod boot;
|
||||||
///
|
///
|
||||||
/// - Only a single core must be active and running this function.
|
/// - Only a single core must be active and running this function.
|
||||||
/// - The init calls in this function must appear in the correct order.
|
/// - The init calls in this function must appear in the correct order.
|
||||||
|
#[inline(always)]
|
||||||
unsafe fn kernel_init(max_kernel_size: u64) -> ! {
|
unsafe fn kernel_init(max_kernel_size: u64) -> ! {
|
||||||
#[cfg(feature = "jtag")]
|
#[cfg(feature = "jtag")]
|
||||||
machine::arch::jtag::wait_debugger();
|
machine::arch::jtag::wait_debugger();
|
||||||
|
@ -66,6 +67,7 @@ fn read_u64() -> u64 {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The main function running after the early init.
|
/// The main function running after the early init.
|
||||||
|
#[inline(always)]
|
||||||
fn kernel_main(max_kernel_size: u64) -> ! {
|
fn kernel_main(max_kernel_size: u64) -> ! {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
test_main();
|
test_main();
|
||||||
|
|
|
@ -24,6 +24,7 @@ macro_rules! entry {
|
||||||
/// # Safety
|
/// # Safety
|
||||||
/// Only type-checks!
|
/// Only type-checks!
|
||||||
#[export_name = "main"]
|
#[export_name = "main"]
|
||||||
|
#[inline(always)]
|
||||||
pub unsafe fn __main() -> ! {
|
pub unsafe fn __main() -> ! {
|
||||||
// type check the given path
|
// type check the given path
|
||||||
let f: fn() -> ! = $path;
|
let f: fn() -> ! = $path;
|
||||||
|
|
Loading…
Reference in New Issue