-
Notifications
You must be signed in to change notification settings - Fork 20
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
Add dedicated mechanism for page tables mapping/unmapping #333
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the overall functionality makes sense but I have my problems with wrapping my head around the prototypes of [un]map_pagetables(cr3_t *, cr3_t *)
.... I just cannot compute to map/unmap a "page table" in a page table.
I see that the implementation is walking the "from" page table and adding/removing existing mappings in the target page table. But, IMHO, it would be much more intuitive if the interface would simply to map/unmap a range of pages at a given virtual address. But then, we already have that -- kind of.
So, what's the use case for all of this? Merging page tables seems to be really a special case I simply cannot think of being useful in a general manor.
In KTF the page tables themselves are not mapped in the address space. Before the 4978793 only initial page tables were mapped and now none of them except the tmp_mfn used for temporal mappings during page tables operations. However, for various tests (PoCs) we do need to access and manipulate the page tables to construct specific scenarios. There is a bunch of helper functions like |
Ok
Makes sense.
And I guess that's where my confusion came from. I was under the assumption that you're trying to merge address spaces but simply mapping the page table pages is something completely different. Sorry my confusion :D |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, only some nits left.
Signed-off-by: Pawel Wieczorkiewicz <[email protected]>
The map_pagetables() function maps all page tables specified in its second parameter into the address space specified by its first parameter. If second parameter is NULL, the current address space page tables are mapped. Only page table frames are being mapped. After mapping a helper function family: get_pte(), get_pde(), ... can be used without causing exceptions. The unmap_pagetables() function unmaps all page tables specified in its second parameter from address space indicated by its first parameter. If second parameter is NULL, the current address space page tables are being unmapped. Signed-off-by: Pawel Wieczorkiewicz <[email protected]>
The map_pagetables_va() function maps page tables pertinent to the virtual address specified by its second parameter into the address space indicated by its first parameter. It is a fine-grained, lightweight version of the map_pagetables(). The unmap_pagetables_va() function unmaps page tables pertinent to the virtual address specified by its second parameter into the address space indicated by its first parameter. It is a fine-grained, lightweight version of the unmap_pagetables(). The unmap_pagetables_va() performs the unmapping regardless of the mapping status of any of the page tables levels. Signed-off-by: Pawel Wieczorkiewicz <[email protected]>
Finally, this ugly hack goes away. Signed-off-by: Pawel Wieczorkiewicz <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks Pawel!
This closes #66.