-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide convenience methods to create PageTables #139
Comments
Could you clarify what you mean with "creating more page tables from an existing page table"? Do you mean to create new independent 4-level page table hierarchies for creating other processes?
What kind of limits do you mean? |
Yes, for creating other processes. The limits in sense, for offset page table, the offset and max address may be for example. |
Ok, thanks for clarifying! I'm still not sure how such a function should look though. The problem is that the One possible way for creating a new page table hierarchy could be: let level_4_page_table = Box::leak(Box::new(PageTable::new()));
let mapper = OffsetPageTable::new(level_4_page_table); This approach works, but it does not handle deallocation of the page table. So you need to do |
Calling |
What do you mean with "update"? |
Creating entries in the page table. Does calling new automatically create the entries? AFAIK it doesn't. |
Ah, I think I understand what you mean now. You basically propose to add methods like the following: impl OffsetPageTable {
/// Creates a new level 4 page table that includes the physical memory mapping.
///
/// Returns a tuple of the new `PageTable` and the offset of the physical memory
/// mapping. These values can then be passed to the `OffsetPageTable::new`
/// function.
pub fn new_level_4_table(&self, frame_allocator: A) -> (PageTable, usize) {…}
}
impl RecursivePageTable {
/// Creates a new level 4 page table with a single recursive entry.
///
/// Returns a tuple of the new `PageTable` and the index of the recursive entry.
/// These values can then be passed to the `RecursivePageTable::new` function.
pub fn new_level_4_table(&self) -> (PageTable, PageTableIndex) {…}
} Did I get understand that right? Such methods seem like a useful addition and I'd be happy to merge a PR for that! |
That is correct. It could also be done so that we pass in the offset instead of it auto deciding an offset but that's optional. |
Oh yeah, that makes sense! |
The current implementations of offset and recursive page table require that
new
to be called with an already existing page table. Provide convenience methods to create more page tables from an existing page table or by taking limits as a parameter to thenew
function.The text was updated successfully, but these errors were encountered: