aboutsummaryrefslogtreecommitdiff
path: root/src/mm/pma.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/mm/pma.rs')
-rw-r--r--src/mm/pma.rs28
1 files changed, 25 insertions, 3 deletions
diff --git a/src/mm/pma.rs b/src/mm/pma.rs
index f9a40ee..aa5e193 100644
--- a/src/mm/pma.rs
+++ b/src/mm/pma.rs
@@ -1,9 +1,31 @@
-use core::ffi::c_void;
use crate::defs::Mem;
+use core::ffi::c_void;
+use core::{ptr, slice};
// this is POC code, it will be ugly
+
extern "C" {
- static KERNEL_END: *const c_void;
+ pub fn ___KERNEL_END__();
+}
+/// Bitmap for physical frames. to get around the chicken-egg problem, we provide a provisional
+/// bitmap of fixed length in the startup code.
+pub struct PFMap {
+ bm: &'static mut [u8],
+ skip: usize, // pfn to skip (because they are already used by the initial kernel image)
+ end: usize, // pfn limit
}
-// pub struct PageAlloctor;
+// TODO PMA initialization : needs to singleton
+
+impl PFMap {}
+pub struct Frame {
+ pfn: usize,
+}
+
+impl Frame {
+ pub fn addr(&self) -> usize {
+ self.pfn << Mem::PAGE_SHIFT
+ }
+}
+
+// pub struct PageAlloctor;