Skip to content
Snippets Groups Projects
Commit fb99ec7e authored by ticki's avatar ticki
Browse files

Strongly typed virtual/physical memory seperation.

This minicommit introduces two newtpyes, `Physical` and `Virtual`,
respectively. These serves as a way to segregate the different forms of
addresses to avoid the issues we had in the old kernel.
parent b2fe1799
No related branches found
No related tags found
Loading
...@@ -23,3 +23,5 @@ pub mod serial; ...@@ -23,3 +23,5 @@ pub mod serial;
/// Task state segment. /// Task state segment.
pub mod tss; pub mod tss;
pub mod physical;
//! 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,
}
/// A newtype representing a virtual address.
#[derive(Copy, Clone, Debug, Eq, Ord, PartialEq, PartialOrd)]
pub struct Virtual {
/// The inner value.
pub inner: usize,
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment