forked from AbleOS/ableos
43 lines
1 KiB
Rust
43 lines
1 KiB
Rust
//! Architecture specific code
|
|
|
|
macro_rules! arch_cond {
|
|
($($arch:ident: $str:literal),* $(,)?) => {$(
|
|
#[cfg(target_arch = $str)]
|
|
pub mod $arch;
|
|
#[cfg(target_arch = $str)]
|
|
pub use self::$arch::*;
|
|
)*};
|
|
}
|
|
|
|
arch_cond!(
|
|
aarch64: "aarch64",
|
|
riscv64: "riscv64",
|
|
x86_64: "x86_64",
|
|
);
|
|
|
|
#[cfg(target_arch = "x86_64")]
|
|
use {crate::arch::interrupts::Interrupt, alloc::string::String};
|
|
#[cfg(target_arch = "x86_64")]
|
|
pub struct InterruptList {
|
|
list: HashMap<Interrupt, String>,
|
|
}
|
|
#[cfg(target_arch = "x86_64")]
|
|
use hashbrown::HashMap;
|
|
#[cfg(target_arch = "x86_64")]
|
|
impl InterruptList {
|
|
pub fn new() -> Self {
|
|
Self {
|
|
list: HashMap::new(),
|
|
}
|
|
}
|
|
}
|
|
#[cfg(target_arch = "x86_64")]
|
|
use spin::{Lazy, Mutex};
|
|
#[cfg(target_arch = "x86_64")]
|
|
pub static INTERRUPT_LIST: Lazy<Mutex<InterruptList>> = Lazy::new(|| {
|
|
let mut il = InterruptList::new();
|
|
use crate::alloc::string::ToString;
|
|
il.list.insert(Interrupt::Timer, "PS/2 Mouse".to_string());
|
|
Mutex::new(il)
|
|
});
|