From f396c3642d58c2631730d3c999efa12df5269e44 Mon Sep 17 00:00:00 2001 From: Erin Date: Mon, 7 Nov 2022 21:21:16 +0100 Subject: [PATCH] Skeleton for architecture-specific things --- kernel/src/arch/aarch64/mod.rs | 1 + kernel/src/arch/mod.rs | 16 ++++++++++++++++ kernel/src/arch/riscv64/mod.rs | 1 + kernel/src/arch/x86_64/mod.rs | 1 + kernel/src/lib.rs | 1 + 5 files changed, 20 insertions(+) create mode 100644 kernel/src/arch/aarch64/mod.rs create mode 100644 kernel/src/arch/mod.rs create mode 100644 kernel/src/arch/riscv64/mod.rs create mode 100644 kernel/src/arch/x86_64/mod.rs diff --git a/kernel/src/arch/aarch64/mod.rs b/kernel/src/arch/aarch64/mod.rs new file mode 100644 index 0000000..cfeed09 --- /dev/null +++ b/kernel/src/arch/aarch64/mod.rs @@ -0,0 +1 @@ +//! \ No newline at end of file diff --git a/kernel/src/arch/mod.rs b/kernel/src/arch/mod.rs new file mode 100644 index 0000000..649461a --- /dev/null +++ b/kernel/src/arch/mod.rs @@ -0,0 +1,16 @@ +//! Architecture specific code + +macro_rules! arch_cond { + ($($arch:ident: $str:literal),* $(,)?) => {$( + #[cfg(target_arch = $str)] + pub mod $arch; + #[cfg(target_arch = $str)] + pub use $arch::*; + )*}; +} + +arch_cond!( + aarch64: "aarch64", + riscv64: "riscv64", + x86_64: "x86_64", +); diff --git a/kernel/src/arch/riscv64/mod.rs b/kernel/src/arch/riscv64/mod.rs new file mode 100644 index 0000000..cfeed09 --- /dev/null +++ b/kernel/src/arch/riscv64/mod.rs @@ -0,0 +1 @@ +//! \ No newline at end of file diff --git a/kernel/src/arch/x86_64/mod.rs b/kernel/src/arch/x86_64/mod.rs new file mode 100644 index 0000000..cfeed09 --- /dev/null +++ b/kernel/src/arch/x86_64/mod.rs @@ -0,0 +1 @@ +//! \ No newline at end of file diff --git a/kernel/src/lib.rs b/kernel/src/lib.rs index 20de4ad..d783ab5 100644 --- a/kernel/src/lib.rs +++ b/kernel/src/lib.rs @@ -7,6 +7,7 @@ extern crate alloc; pub mod allocator; +pub mod arch; pub mod task; use versioning::Version;