added some comments

This commit is contained in:
Steffen Vogel 2013-10-10 11:48:00 +02:00 committed by Steffen Vogel
parent 9621509e78
commit 2f2dd1d3c7

View file

@ -403,6 +403,7 @@ static int sys_sbrk(int incr)
spinlock_lock(&task->vma_lock);
// search vma containing the heap
tmp = task->vma_list;
while(tmp && !((task->end_heap >= tmp->start) && (task->end_heap <= tmp->end)))
tmp = tmp->next;
@ -411,11 +412,16 @@ static int sys_sbrk(int incr)
task->end_heap += incr;
if (task->end_heap < task->start_heap)
task->end_heap = task->start_heap;
// resize virtual memory area
if (tmp && (tmp->end <= task->end_heap))
tmp->end = task->end_heap;
// allocation and mapping of new pages for the heap
// is catched by the pagefault handler
//kprintf("sys_sbrk: tid=%d, start_heap=%8x, end_heap=%8x, incr=%4x\n", task->id, task->start_heap, task->end_heap, incr);
spinlock_unlock(&task->vma_lock);
return ret;