Skip to content

Commit

Permalink
Access the console device table with IRQ disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
lrh2000 authored and tatetian committed Apr 10, 2024
1 parent e4fd51b commit bd8be26
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions kernel/comps/console/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub fn register_device(name: String, device: Arc<dyn AnyConsoleDevice>) {
.get()
.unwrap()
.console_device_table
.lock()
.lock_irq_disabled()
.insert(name, device);
}

Expand All @@ -37,13 +37,17 @@ pub fn get_device(str: &str) -> Option<Arc<dyn AnyConsoleDevice>> {
.get()
.unwrap()
.console_device_table
.lock()
.lock_irq_disabled()
.get(str)
.cloned()
}

pub fn all_devices() -> Vec<(String, Arc<dyn AnyConsoleDevice>)> {
let console_devs = COMPONENT.get().unwrap().console_device_table.lock();
let console_devs = COMPONENT
.get()
.unwrap()
.console_device_table
.lock_irq_disabled();
console_devs
.iter()
.map(|(name, device)| (name.clone(), device.clone()))
Expand Down

0 comments on commit bd8be26

Please sign in to comment.