I already have the physical memory manager working and it has methods for allocating contiguous pages or just a single page ( and freeing them ) so i believe that is done..
here is the main functions that are things outside the core paging might use (meaning i am not listing every helper function/macro)
Code: Select all
void allocatePageTable(uint pdir, uint virt, uint flags)
void MapPhysicalAddress(uint pdir, uint vaddr, uint paddr, uint flags)
void invlpg(uint addr)
/* allocates an address space for a new task
starting with 'pages' amount of pages
*/
void allocAddressSpace(int pages)
also I had a question about allocAddressSpace because I am not quite sure of the flow for it. I know that it will have to allocate at least one page to be the page directory for the new task, then to use the last entry trick map itself into the last slot, but what about for the rest of the entries? If I am going to have the kernels pages mapped into every task is this the place to do it? I thought it might be a good place to set the the permissions for the kernel regions ( I have my kernel mapped to 0xc0000000 and will let it expand to higher addresses) but I do not know if that is the best function to put it in.
and for clean design should MapPhysicalAddress be the only thing to ever call allocatePageTable? I could not think of any other function that would need a page table brought in, and once kmalloc is implemented all the other parts of the kernel that need memory should rely on that anyway
I realize there was alot of questions in here but I wanted to have everything clear before I finish the code and move on to multitasking.