make munmap free physical pages, and one correction for aligned mmap in syscall.c (extend_process_region is called with memory-region start-address which is aligned (map_end_aligned), instead of tail-address of current-region (region->map_end)) for aligned mmap (in syscall.c)

This commit is contained in:
Masamichi Takagi m-takagi@ab.jp.nec.com
2012-10-30 21:32:49 +09:00
parent 50431b7584
commit e7317cca98
5 changed files with 31 additions and 13 deletions

View File

@@ -283,22 +283,29 @@ unsigned long extend_process_region(struct process *proc,
return address;
}
int remove_process_region(struct process *proc,
unsigned long start, unsigned long end)
int remove_process_region(struct process *proc, unsigned long va_start, unsigned long va_end, unsigned long pa)
{
unsigned long flags;
if ((start & (PAGE_SIZE - 1)) || (end & (PAGE_SIZE - 1))) {
if ((va_start & (PAGE_SIZE - 1)) || (va_end & (PAGE_SIZE - 1))) {
return -EINVAL;
}
flags = aal_mc_spinlock_lock(&proc->vm->page_table_lock);
/* We defer freeing to the time of exit */
while (start < end) {
aal_mc_pt_clear_page(proc->vm->page_table, (void *)start);
start += PAGE_SIZE;
unsigned long va = va_start;
while (va < va_end) {
aal_mc_pt_clear_page(proc->vm->page_table, (void *)va);
va += PAGE_SIZE;
}
aal_mc_spinlock_unlock(&proc->vm->page_table_lock, flags);
// we skip freeing "range"
#if 1
kprintf("process.c,free_pages,pa=%lx,start=%lx,end=%lx\n", pa, va_start, va_end);
free_pages_pa(pa, (va_end - va_start) / PAGE_SIZE);
#endif
return 0;
}