mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-30 00:23:24 +00:00
Move SoftIRQ implementations to softirq component
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
54a807b5f7
commit
2f511069ee
@ -39,6 +39,7 @@ use crate::arch;
|
||||
/// println!("2nd FOO VAL: {:?}", FOO.load());
|
||||
/// }
|
||||
/// ```
|
||||
#[macro_export]
|
||||
macro_rules! cpu_local_cell {
|
||||
($( $(#[$attr:meta])* $vis:vis static $name:ident: $t:ty = $init:expr; )*) => {
|
||||
$(
|
||||
@ -55,8 +56,6 @@ macro_rules! cpu_local_cell {
|
||||
};
|
||||
}
|
||||
|
||||
pub(crate) use cpu_local_cell;
|
||||
|
||||
/// Inner mutable CPU-local objects.
|
||||
///
|
||||
/// CPU-local cell objects are only accessible from the current CPU. When
|
||||
@ -71,6 +70,10 @@ pub(crate) use cpu_local_cell;
|
||||
/// You should only create the CPU-local cell object using the macro
|
||||
/// [`cpu_local_cell!`].
|
||||
///
|
||||
/// Please exercise extreme caution when using `CpuLocalCell`. In most cases,
|
||||
/// it is necessary to disable interrupts or preemption when using it to prevent
|
||||
/// the operated object from being changed, which can lead to race conditions.
|
||||
///
|
||||
/// For the difference between [`super::CpuLocal`] and [`CpuLocalCell`], see
|
||||
/// [`super`].
|
||||
pub struct CpuLocalCell<T: 'static>(UnsafeCell<T>);
|
||||
|
@ -28,10 +28,6 @@
|
||||
// the CPU-local objects can be shared across CPUs. While through a CPU-local
|
||||
// cell object you can only access the value on the current CPU, therefore
|
||||
// enabling inner mutability without locks.
|
||||
//
|
||||
// The cell-variant is currently not a public API because that it is rather
|
||||
// hard to be used without introducing races. But it is useful for OSTD's
|
||||
// internal implementation.
|
||||
|
||||
mod cell;
|
||||
mod cpu_local;
|
||||
@ -41,7 +37,7 @@ pub(crate) mod single_instr;
|
||||
use alloc::vec::Vec;
|
||||
|
||||
use align_ext::AlignExt;
|
||||
pub(crate) use cell::{cpu_local_cell, CpuLocalCell};
|
||||
pub use cell::CpuLocalCell;
|
||||
pub use cpu_local::{CpuLocal, CpuLocalDerefGuard};
|
||||
use spin::Once;
|
||||
|
||||
|
@ -13,11 +13,11 @@ cfg_if::cfg_if! {
|
||||
}
|
||||
|
||||
use bitvec::prelude::BitVec;
|
||||
use local::cpu_local_cell;
|
||||
use spin::Once;
|
||||
|
||||
use crate::{
|
||||
arch::boot::smp::get_num_processors, task::DisabledPreemptGuard, trap::DisabledLocalIrqGuard,
|
||||
arch::boot::smp::get_num_processors, cpu_local_cell, task::DisabledPreemptGuard,
|
||||
trap::DisabledLocalIrqGuard,
|
||||
};
|
||||
|
||||
/// The number of CPUs.
|
||||
|
Reference in New Issue
Block a user