You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
// SPDX-License-Identifier: MIT OR Apache-2.0
|
|
|
|
//
|
|
|
|
// Copyright (c) 2018-2022 Andre Richter <andre.o.richter@gmail.com>
|
|
|
|
|
|
|
|
//! Architectural symmetric multiprocessing.
|
|
|
|
//!
|
|
|
|
//! # Orientation
|
|
|
|
//!
|
|
|
|
//! Since arch modules are imported into generic modules using the path attribute, the path of this
|
|
|
|
//! file is:
|
|
|
|
//!
|
|
|
|
//! crate::cpu::smp::arch_smp
|
|
|
|
|
|
|
|
use aarch64_cpu::registers::*;
|
|
|
|
use tock_registers::interfaces::Readable;
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
// Public Code
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
/// Return the executing core's id.
|
|
|
|
#[inline(always)]
|
|
|
|
pub fn core_id<T>() -> T
|
|
|
|
where
|
|
|
|
T: From<u8>,
|
|
|
|
{
|
|
|
|
const CORE_MASK: u64 = 0b11;
|
|
|
|
|
|
|
|
T::from((MPIDR_EL1.get() & CORE_MASK) as u8)
|
|
|
|
}
|