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:
@@ -86,8 +86,10 @@ sh4_invl_page(addr va)
|
|||||||
void
|
void
|
||||||
arch_cpu_invalidate_TLB_range(addr start, addr end)
|
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);
|
sh4_invl_page(start);
|
||||||
|
start += PAGE_SIZE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -123,8 +123,10 @@ i386_set_kstack(addr kstack)
|
|||||||
void
|
void
|
||||||
arch_cpu_invalidate_TLB_range(addr start, addr end)
|
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);
|
invalidate_TLB(start);
|
||||||
|
start += PAGE_SIZE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -584,8 +584,10 @@ dprintf("vm_translation_map_create\n");
|
|||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
|
|
||||||
new_map->arch_data = (vm_translation_map_arch_info *)kmalloc(sizeof(vm_translation_map_arch_info));
|
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;
|
return ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
new_map->arch_data->num_invalidate_pages = 0;
|
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);
|
new_map->arch_data->pgdir_virt = kmalloc(PAGE_SIZE);
|
||||||
if(new_map->arch_data->pgdir_virt == NULL) {
|
if(new_map->arch_data->pgdir_virt == NULL) {
|
||||||
kfree(new_map->arch_data);
|
kfree(new_map->arch_data);
|
||||||
|
recursive_lock_destroy(&new_map->lock);
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
if(((addr)new_map->arch_data->pgdir_virt % PAGE_SIZE) != 0)
|
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->rw = attributes & LOCK_RW;
|
||||||
pentry->present = 1;
|
pentry->present = 1;
|
||||||
|
|
||||||
arch_cpu_invalidate_TLB_range(va, va+1);
|
arch_cpu_invalidate_TLB_range(va, va);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ static void scan_pages(vm_address_space *aspace, addr free_target)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
page = vm_lookup_page(pa);
|
page = vm_lookup_page(pa / PAGE_SIZE);
|
||||||
if(!page) {
|
if(!page) {
|
||||||
aspace->translation_map.ops->unlock(&aspace->translation_map);
|
aspace->translation_map.ops->unlock(&aspace->translation_map);
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -613,7 +613,7 @@ vm_page *vm_lookup_page(addr page_num)
|
|||||||
if(page_num < physical_page_offset)
|
if(page_num < physical_page_offset)
|
||||||
return NULL;
|
return NULL;
|
||||||
page_num -= physical_page_offset;
|
page_num -= physical_page_offset;
|
||||||
if(page_num > num_pages)
|
if(page_num >= num_pages)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return &all_pages[page_num];
|
return &all_pages[page_num];
|
||||||
|
|||||||
Reference in New Issue
Block a user