A few quick fixes for some VM bugs.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1461 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
notion
2002-10-08 21:16:24 +00:00
parent 1d1c11443f
commit ea4148fa59
5 changed files with 13 additions and 6 deletions
+3 -1
View File
@@ -86,8 +86,10 @@ sh4_invl_page(addr va)
void
arch_cpu_invalidate_TLB_range(addr start, addr end)
{
for(; start < end; start += PAGE_SIZE) {
int num_pages = end/PAGE_SIZE - start/PAGE_SIZE;
while ( num_pages-- >= 0 ) {
sh4_invl_page(start);
start += PAGE_SIZE;
}
}
+3 -1
View File
@@ -123,8 +123,10 @@ i386_set_kstack(addr kstack)
void
arch_cpu_invalidate_TLB_range(addr start, addr end)
{
for (; start < end; start += PAGE_SIZE) {
int num_pages = end/PAGE_SIZE - start/PAGE_SIZE;
while ( num_pages-- >= 0 ) {
invalidate_TLB(start);
start += PAGE_SIZE;
}
}
@@ -584,8 +584,10 @@ dprintf("vm_translation_map_create\n");
return ENOMEM;
new_map->arch_data = (vm_translation_map_arch_info *)kmalloc(sizeof(vm_translation_map_arch_info));
if(new_map == NULL)
if(new_map == NULL) {
recursive_lock_destroy(&new_map->lock);
return ENOMEM;
}
new_map->arch_data->num_invalidate_pages = 0;
@@ -595,6 +597,7 @@ dprintf("vm_translation_map_create\n");
new_map->arch_data->pgdir_virt = kmalloc(PAGE_SIZE);
if(new_map->arch_data->pgdir_virt == NULL) {
kfree(new_map->arch_data);
recursive_lock_destroy(&new_map->lock);
return ENOMEM;
}
if(((addr)new_map->arch_data->pgdir_virt % PAGE_SIZE) != 0)
@@ -784,7 +787,7 @@ int vm_translation_map_quick_map(kernel_args *ka, addr va, addr pa, unsigned int
pentry->rw = attributes & LOCK_RW;
pentry->present = 1;
arch_cpu_invalidate_TLB_range(va, va+1);
arch_cpu_invalidate_TLB_range(va, va);
return 0;
}
+1 -1
View File
@@ -58,7 +58,7 @@ static void scan_pages(vm_address_space *aspace, addr free_target)
continue;
}
page = vm_lookup_page(pa);
page = vm_lookup_page(pa / PAGE_SIZE);
if(!page) {
aspace->translation_map.ops->unlock(&aspace->translation_map);
continue;
+1 -1
View File
@@ -613,7 +613,7 @@ vm_page *vm_lookup_page(addr page_num)
if(page_num < physical_page_offset)
return NULL;
page_num -= physical_page_offset;
if(page_num > num_pages)
if(page_num >= num_pages)
return NULL;
return &all_pages[page_num];