aboutsummaryrefslogtreecommitdiff
path: root/src/mm/pma.rs
blob: aa5e193d5694438e16616d14188f995e6641bda9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use crate::defs::Mem;
use core::ffi::c_void;
use core::{ptr, slice};
// this is POC code, it will be ugly

extern "C" {
	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
}

// 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;