Changeset View
Changeset View
Standalone View
Standalone View
vm/vm_phys.c
Show First 20 Lines • Show All 962 Lines • ▼ Show 20 Lines | |||||
* the alignment of the lowest physical page in the run. If the specified | * the alignment of the lowest physical page in the run. If the specified | ||||
* "boundary" is non-zero, then the run of physical pages cannot span a | * "boundary" is non-zero, then the run of physical pages cannot span a | ||||
* physical address that is a multiple of "boundary". | * physical address that is a multiple of "boundary". | ||||
* | * | ||||
* "npages" must be greater than zero. Both "alignment" and "boundary" must | * "npages" must be greater than zero. Both "alignment" and "boundary" must | ||||
* be a power of two. | * be a power of two. | ||||
*/ | */ | ||||
vm_page_t | vm_page_t | ||||
vm_phys_scan_contig(u_long npages, vm_paddr_t low, vm_paddr_t high, | vm_phys_scan_contig(int domain, u_long npages, vm_paddr_t low, vm_paddr_t high, | ||||
u_long alignment, vm_paddr_t boundary, int options) | u_long alignment, vm_paddr_t boundary, int options) | ||||
{ | { | ||||
vm_paddr_t pa_end; | vm_paddr_t pa_end; | ||||
vm_page_t m_end, m_run, m_start; | vm_page_t m_end, m_run, m_start; | ||||
struct vm_phys_seg *seg; | struct vm_phys_seg *seg; | ||||
int segind; | int segind; | ||||
KASSERT(npages > 0, ("npages is 0")); | KASSERT(npages > 0, ("npages is 0")); | ||||
KASSERT(powerof2(alignment), ("alignment is not a power of 2")); | KASSERT(powerof2(alignment), ("alignment is not a power of 2")); | ||||
KASSERT(powerof2(boundary), ("boundary is not a power of 2")); | KASSERT(powerof2(boundary), ("boundary is not a power of 2")); | ||||
if (low >= high) | if (low >= high) | ||||
return (NULL); | return (NULL); | ||||
for (segind = 0; segind < vm_phys_nsegs; segind++) { | for (segind = 0; segind < vm_phys_nsegs; segind++) { | ||||
seg = &vm_phys_segs[segind]; | seg = &vm_phys_segs[segind]; | ||||
if (seg->domain != domain) | |||||
continue; | |||||
if (seg->start >= high) | if (seg->start >= high) | ||||
break; | break; | ||||
if (low >= seg->end) | if (low >= seg->end) | ||||
continue; | continue; | ||||
if (low <= seg->start) | if (low <= seg->start) | ||||
m_start = seg->first_page; | m_start = seg->first_page; | ||||
else | else | ||||
m_start = &seg->first_page[atop(low - seg->start)]; | m_start = &seg->first_page[atop(low - seg->start)]; | ||||
▲ Show 20 Lines • Show All 266 Lines • Show Last 20 Lines |