diff options
| author | Tianhao Wang <wth@riseup.net> | 2024-02-25 04:55:09 +0100 |
|---|---|---|
| committer | Tianhao Wang <shrik3@mailbox.org> | 2024-06-11 15:13:38 +0200 |
| commit | dbefd9336cc808e76f8e9d8d238f5a348d14604a (patch) | |
| tree | c373589d1492141da6caa1c0668f8cd3eeddac80 /src/mm/pma.rs | |
| parent | 9f7d1bf474ac3e3b1c658bf2167afbf056e99c58 (diff) | |
add mm and ds modules (yet empty)
Diffstat (limited to 'src/mm/pma.rs')
| -rw-r--r-- | src/mm/pma.rs | 28 |
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; |
