diff options
author | Christian Cunningham <cc@localhost> | 2022-08-26 19:49:13 -0700 |
---|---|---|
committer | Christian Cunningham <cc@localhost> | 2022-08-26 19:49:13 -0700 |
commit | 2b61ad947c64d76875311e6af08c87a5592055b3 (patch) | |
tree | 81b8ce619cb78986ec8bec13177c05b477ccb6e6 /src/_arch/arm/cpu/boot.rs | |
parent | a04cf2dbb8d2e890405fbf0a1022aaad3015b1e8 (diff) |
SpinLocks
Diffstat (limited to 'src/_arch/arm/cpu/boot.rs')
-rw-r--r-- | src/_arch/arm/cpu/boot.rs | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/_arch/arm/cpu/boot.rs b/src/_arch/arm/cpu/boot.rs index b81a16a..1b4ed74 100644 --- a/src/_arch/arm/cpu/boot.rs +++ b/src/_arch/arm/cpu/boot.rs @@ -18,3 +18,54 @@ global_asm!(include_str!("boot.s")); pub unsafe fn _start_rust() -> ! { crate::kernel_init() } + +/// # Rust entry for other cores of the `kernel` binary. +/// +/// This function is unmangled so that the +/// ASM boot code can switch to Rust safely. +#[no_mangle] +pub extern "C" fn _start_other_core(_core: u32) -> ! { + loop { + use crate::INITIALIZED_BOOL; + use core::sync::atomic::Ordering; + if let Ok(true) = + INITIALIZED_BOOL.compare_exchange(true, false, Ordering::Acquire, Ordering::Relaxed) + { + crate::serial_println!("Ran core {}!", _core); + let u = crate::Box::<u32>::new(42); + crate::serial_println!("{}", u); + INITIALIZED_BOOL.store(true, Ordering::Release); + break; + } + } + #[allow(unreachable_code)] + loop {} +} + +/// # Prefetch +#[no_mangle] +pub extern "C" fn prefetch() -> ! { + crate::serial_println!("Prefetch handler"); + loop {} +} + +/// # Data +#[no_mangle] +pub extern "C" fn data() -> ! { + crate::serial_println!("Data handler"); + loop {} +} + +/// # IRQ +#[no_mangle] +pub extern "C" fn irq() -> ! { + crate::serial_println!("IRQ handler"); + loop {} +} + +/// # FIQ +#[no_mangle] +pub extern "C" fn fiq() -> ! { + crate::serial_println!("FIQ handler"); + loop {} +} |