Changeset View
Changeset View
Standalone View
Standalone View
sys/vm/vm_kern.c
Show First 20 Lines • Show All 692 Lines • ▼ Show 20 Lines | kmem_init_zero_region(void) | ||||
vm_page_t m; | vm_page_t m; | ||||
/* | /* | ||||
* Map a single physical page of zeros to a larger virtual range. | * Map a single physical page of zeros to a larger virtual range. | ||||
* This requires less looping in places that want large amounts of | * This requires less looping in places that want large amounts of | ||||
* zeros, while not using much more physical resources. | * zeros, while not using much more physical resources. | ||||
*/ | */ | ||||
addr = kva_alloc(ZERO_REGION_SIZE); | addr = kva_alloc(ZERO_REGION_SIZE); | ||||
m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | | m = vm_page_alloc_noobj(VM_ALLOC_WIRED | VM_ALLOC_ZERO); | ||||
VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | VM_ALLOC_ZERO); | |||||
if ((m->flags & PG_ZERO) == 0) | |||||
pmap_zero_page(m); | |||||
for (i = 0; i < ZERO_REGION_SIZE; i += PAGE_SIZE) | for (i = 0; i < ZERO_REGION_SIZE; i += PAGE_SIZE) | ||||
pmap_qenter(addr + i, &m, 1); | pmap_qenter(addr + i, &m, 1); | ||||
pmap_protect(kernel_pmap, addr, addr + ZERO_REGION_SIZE, VM_PROT_READ); | pmap_protect(kernel_pmap, addr, addr + ZERO_REGION_SIZE, VM_PROT_READ); | ||||
zero_region = (const void *)addr; | zero_region = (const void *)addr; | ||||
} | } | ||||
/* | /* | ||||
▲ Show 20 Lines • Show All 244 Lines • Show Last 20 Lines |