sbrk()

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
shad

sbrk()

Post by shad »

Should sbrk() perform the mapping of physical memory or just extend the heap pointer and let the page fault handler do the mapping. Also, lets say your in the page fault handler, and memory was accessed that a whole table doesnt exist for, how can you tell if it was because there was no table or no page, because i wouldnt want to map a whole new table just for one page..
Tim

Re:sbrk()

Post by Tim »

shad wrote:Should sbrk() perform the mapping of physical memory or just extend the heap pointer and let the page fault handler do the mapping.
It's up to you. That's a design decision which depends on your kernel.
Also, lets say your in the page fault handler, and memory was accessed that a whole table doesnt exist for, how can you tell if it was because there was no table or no page, because i wouldnt want to map a whole new table just for one page..
Firstly, you've got to allocate a new page table, even if there's only one page mapped there.

It's easy to check whether the fault occurred because there was no page table present: just look up the PDE for the fault address and check the present bit.
shad

Re:sbrk()

Post by shad »

hmm.. i see, but what i meant was i wouldnt want to allocate a new table if there was already one there. And i think ill let the page fault handler map it.. But thanks for all your help i think i know what to do... OFF TO THE RACES
Post Reply