| 517 | |
| 518 | #ifndef PMAP_HAS_PAGE_ARRAY |
| 519 | static vm_paddr_t |
| 520 | vm_page_array_alloc(vm_offset_t *vaddr, vm_paddr_t end, vm_paddr_t page_range) |
| 521 | { |
| 522 | vm_paddr_t new_end; |
| 523 | |
| 524 | /* |
| 525 | * Reserve an unmapped guard page to trap access to vm_page_array[-1]. |
| 526 | * However, because this page is allocated from KVM, out-of-bounds |
| 527 | * accesses using the direct map will not be trapped. |
| 528 | */ |
| 529 | *vaddr += PAGE_SIZE; |
| 530 | |
| 531 | /* |
| 532 | * Allocate physical memory for the page structures, and map it. |
| 533 | */ |
| 534 | new_end = trunc_page(end - page_range * sizeof(struct vm_page)); |
| 535 | vm_page_array = (vm_page_t)pmap_map(vaddr, new_end, end, |
| 536 | VM_PROT_READ | VM_PROT_WRITE); |
| 537 | vm_page_array_size = page_range; |
| 538 | |
| 539 | return (new_end); |
| 540 | } |
| 541 | #endif |
| 542 | |
| 543 | /* |
no test coverage detected