-
Notifications
You must be signed in to change notification settings - Fork 19
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
Implement memory range mapping/unmapping; Cleanup and standardize vmap API #308
Conversation
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.
Great work, Pawel. Only a few nits and questions left, but really no more code changes required.
The comment regarding only being able to unmap single pages via SYSCALL_MUNMAP still applies. But I guess, now with v[un]map_range()
available, it's easy to extend the functionality to cover multiple pages. But this can (and should!) be a follow-up change.
Thanks again for the hard work!
Thanks very much Mathias! I created a dedicated issue for the mmap/munmap usermode extension: #332. This should also depend on another issue: #331, but in general should be much easier to implement now. |
Summary of the changes: * Get rid of kmap() API - it was confusing and non-standard * Add set of generic vmap APIs and make them public - These functions allow to specify all parameters * All level PT flags * Address space (via CR3 pointer) * Add set of order-specific (4K, 2M, 1G) public vmap APIs - Use default PT flags for non-last level - Allow to propagate user bit on request * Add separate sets of APIs for kernel and user address spaces * Move all interface definitions from page.h to pagetable.h Signed-off-by: Pawel Wieczorkiewicz <[email protected]>
This API allows to automatically map (or unmap) a range of physical addresses specified with a start address and length. Both vmap_range() and vunmap_range() allow to automatically map the physical address range into multiple different memory areas specified via vmap_flags parameter. Support memory areas via vmap_flags: * VMAP_IDENT - kernel address space, identity mapping * VMAP_KERNEL - high kernel addresses (small area) * VMAP_KERNEL_MAP - low kernel addresses (large area) * VMAP_KERNEL_USER - kernel address space, but user memory area * VMAP_KERNEL_USER_ACCESS - kernel address space, but user memory area with user access permission * VMAP_USER - user address space, user memory area * VMAP_USER_IDENT - user address space, identity mapping, no user access * VMAP_USER_KERNEL - user address space, high kernel addresses, no user access * VMAP_USER_KERNEL_MAP - user address space, low kernel addresses, no user access The vmap_range() tries to use as many huge pages as possible for the mapping. Signed-off-by: Pawel Wieczorkiewicz <[email protected]>
Use vmap_range() to handle multiple mapping areas automatically and consistently. Standardize rules for virtual address returned by get_free_pages(). 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!
This resolves #253.