diff --git a/arch/x86_64/mod.rs b/arch/x86_64/mod.rs index f9239d2345ce8bb1de50c15ad763e5ad2f8eb605..d5180fc0582b07d7c545ce7f026270b0da6b35df 100644 --- a/arch/x86_64/mod.rs +++ b/arch/x86_64/mod.rs @@ -23,3 +23,5 @@ pub mod serial; /// Task state segment. pub mod tss; + +pub mod physical; diff --git a/arch/x86_64/physical.rs b/arch/x86_64/physical.rs new file mode 100644 index 0000000000000000000000000000000000000000..8885cd1c5e7edb99cf6e992a521d1c071b692839 --- /dev/null +++ b/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/paging/mod.rs b/paging/mod.rs new file mode 100644 index 0000000000000000000000000000000000000000..f01796217a373d3a047bf27f1d713f698d530ca1 --- /dev/null +++ b/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, +}