From d827f51bb68c8c179a29a7d8f8e03860ee04ef08 Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Tue, 8 Dec 2015 22:14:42 +0100 Subject: [PATCH] Create basic paging module --- src/memory/mod.rs | 3 ++- src/memory/paging/mod.rs | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 src/memory/paging/mod.rs diff --git a/src/memory/mod.rs b/src/memory/mod.rs index 7bfc85d8..7287b464 100644 --- a/src/memory/mod.rs +++ b/src/memory/mod.rs @@ -1,6 +1,7 @@ pub use self::area_frame_allocator::AreaFrameAllocator; mod area_frame_allocator; +mod paging; pub const PAGE_SIZE: usize = 4096; @@ -11,7 +12,7 @@ pub struct Frame { impl Frame { fn containing_address(address: usize) -> Frame { - Frame{ number: address / PAGE_SIZE } + Frame { number: address / PAGE_SIZE } } } diff --git a/src/memory/paging/mod.rs b/src/memory/paging/mod.rs new file mode 100644 index 00000000..ae5b85fd --- /dev/null +++ b/src/memory/paging/mod.rs @@ -0,0 +1,8 @@ +const ENTRY_COUNT: usize = 512; + +pub type PhysicalAddress = usize; +pub type VirtualAddress = usize; + +pub struct Page { + number: usize, +}