forked from koniifer/ableos
27 lines
557 B
Rust
27 lines
557 B
Rust
|
use lazy_static::lazy_static;
|
||
|
|
||
|
lazy_static! {
|
||
|
pub static ref KERNEL_STATE: spin::Mutex<KernelInternalState> =
|
||
|
spin::Mutex::new(KernelInternalState::new());
|
||
|
}
|
||
|
|
||
|
pub struct KernelInternalState {
|
||
|
should_shutdown: bool,
|
||
|
}
|
||
|
|
||
|
impl KernelInternalState {
|
||
|
pub fn new() -> Self {
|
||
|
Self {
|
||
|
should_shutdown: false,
|
||
|
}
|
||
|
}
|
||
|
pub fn shutdown(&mut self) {
|
||
|
self.should_shutdown = true;
|
||
|
}
|
||
|
pub fn update_state(&mut self) {
|
||
|
if self.should_shutdown {
|
||
|
crate::arch::shutdown();
|
||
|
}
|
||
|
}
|
||
|
}
|