mapping and page tables?
mapping and page tables?
Ok, I have a function map_page( ) which maps in a page of memory. Let's hypothetically say that map_page( ) is trying to map in a page that does not have the proper page table present. Should the function automatically create the page table, or return an error code?
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:mapping and page tables?
what about map_page(PGMAP_AUTO) ?
if the PGMAP_AUTO flag is set, then needed entries are automatically allocated (including page table, etc.) and otherwise an error is returned
So that you can use the very same function for memory allocation (if you're filling a large virtual array, PGMAP_AUTO is set ... if you're responding to a #page fault from user mode, PGMAP_AUTO is likely to be cleared).
if the PGMAP_AUTO flag is set, then needed entries are automatically allocated (including page table, etc.) and otherwise an error is returned
So that you can use the very same function for memory allocation (if you're filling a large virtual array, PGMAP_AUTO is set ... if you're responding to a #page fault from user mode, PGMAP_AUTO is likely to be cleared).
Re:mapping and page tables?
What reason could there be for not allocating the page table if none exists? If there is no page table there, then the address is not mapped.
Re:mapping and page tables?
I agree with Tim, if you don't create a page table entry then it *wont* work.
My code just checks for the existence of a PTE when it crosses a PT boundary and creates if necessary.
My code just checks for the existence of a PTE when it crosses a PT boundary and creates if necessary.
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:mapping and page tables?
oh, i was assuming that maybe the user may have requested an allocation for a memory address he shouldn't request and maybe we shouldn't allocate in that case ...
Re:mapping and page tables?
Yeah, I initially was going to just have it automatically allocate everything, but then I thought it should prevent the user from allocating from areas that shouldn't be allocated, like Pype.Clicker mentioned. Figured I'd ask to see what's the best system of doing things.
I like Pype.Clicker's idea with a PGMAP_AUTO type of flag to toggle the functionality, that's probably what I'll do.
Thanks for the help everyone.
I like Pype.Clicker's idea with a PGMAP_AUTO type of flag to toggle the functionality, that's probably what I'll do.
Thanks for the help everyone.