diff --git a/kernel/arch/x86_64/mod.rs b/kernel/arch/x86_64/mod.rs index f9239d2..d5180fc 100644 --- a/kernel/arch/x86_64/mod.rs +++ b/kernel/arch/x86_64/mod.rs @@ -23,3 +23,5 @@ pub mod serial; /// Task state segment. pub mod tss; + +pub mod physical; diff --git a/kernel/arch/x86_64/physical.rs b/kernel/arch/x86_64/physical.rs new file mode 100644 index 0000000..8885cd1 --- /dev/null +++ b/kernel/arch/x86_64/physical.rs @@ -0,0 +1,11 @@ +//! Typestrong address segregation. + +/// A physical address in memory. +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct Physical { + /// The position. + /// + /// Note that we do not use a pointer here to avoid simple mistakes where the programmer + /// confuse virtual and physical. + pub inner: u64, +} diff --git a/kernel/paging/mod.rs b/kernel/paging/mod.rs new file mode 100644 index 0000000..f017962 --- /dev/null +++ b/kernel/paging/mod.rs @@ -0,0 +1,6 @@ +/// A newtype representing a virtual address. +#[derive(Copy, Clone, Debug, Eq, Ord, PartialEq, PartialOrd)] +pub struct Virtual { + /// The inner value. + pub inner: usize, +}