aboutsummaryrefslogtreecommitdiff
path: root/src/_arch/arm/cpu/boot.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/_arch/arm/cpu/boot.rs')
-rw-r--r--src/_arch/arm/cpu/boot.rs51
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 {}
+}