Skip to content

Commit

Permalink
kernel: add lock-step multicore spinlock macro and step between share…
Browse files Browse the repository at this point in the history
…d/local init
  • Loading branch information
Qix- committed Jul 29, 2024
1 parent 731bfe6 commit 0c701fc
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion oro-kernel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,28 @@ pub enum CoreType {
/// Specifically, all safety requirements must be met, such as
/// marking exactly one core as primary.
pub unsafe fn boot<A: Arch>(core_config: &CoreConfig) -> ! {
#[allow(clippy::missing_docs_in_private_items)]
macro_rules! wait_for_all_cores {
() => {{
static BARRIER: ::oro_common::sync::SpinBarrier =
::oro_common::sync::SpinBarrier::new();

if core_config.core_type == CoreType::Primary {
BARRIER.set_total::<A>(core_config.boot_config.core_count);
}

BARRIER.wait();
}};
}

A::disable_interrupts();
A::after_transfer();

if core_config.core_type == CoreType::Primary {
A::init_shared();
}

// TODO(qix-): barrier. But we need the core count from the boot protocol info first.
wait_for_all_cores!();

A::init_local();

Expand Down

0 comments on commit 0c701fc

Please sign in to comment.