added some comments
This commit is contained in:
parent
9621509e78
commit
2f2dd1d3c7
1 changed files with 7 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue