Changeset View
Changeset View
Standalone View
Standalone View
sys/vm/vm_phys.c
Show First 20 Lines • Show All 891 Lines • ▼ Show 20 Lines | vm_phys_alloc_freelist_pages(int domain, int freelist, int pool, int order) | ||||
} | } | ||||
return (NULL); | return (NULL); | ||||
} | } | ||||
/* | /* | ||||
* Find the vm_page corresponding to the given physical address. | * Find the vm_page corresponding to the given physical address. | ||||
*/ | */ | ||||
vm_page_t | vm_page_t | ||||
vm_phys_paddr_to_vm_page(vm_paddr_t pa) | vm_phys_paddr_to_vm_page(vm_paddr_t pa, u_long *cnt_after) | ||||
{ | { | ||||
struct vm_phys_seg *seg; | struct vm_phys_seg *seg; | ||||
int segind; | int segind; | ||||
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 (pa >= seg->start && pa < seg->end) | if (pa >= seg->start && pa < seg->end) { | ||||
if (cnt_after != NULL) | |||||
*cnt_after = atop(seg->end - pa); | |||||
return (&seg->first_page[atop(pa - seg->start)]); | return (&seg->first_page[atop(pa - seg->start)]); | ||||
} | } | ||||
} | |||||
return (NULL); | return (NULL); | ||||
} | } | ||||
vm_page_t | vm_page_t | ||||
vm_phys_fictitious_to_vm_page(vm_paddr_t pa) | vm_phys_fictitious_to_vm_page(vm_paddr_t pa, u_long *cnt_after) | ||||
{ | { | ||||
struct vm_phys_fictitious_seg tmp, *seg; | struct vm_phys_fictitious_seg tmp, *seg; | ||||
vm_page_t m; | vm_page_t m; | ||||
m = NULL; | m = NULL; | ||||
tmp.start = pa; | tmp.start = pa; | ||||
tmp.end = 0; | tmp.end = 0; | ||||
rw_rlock(&vm_phys_fictitious_reg_lock); | rw_rlock(&vm_phys_fictitious_reg_lock); | ||||
seg = RB_FIND(fict_tree, &vm_phys_fictitious_tree, &tmp); | seg = RB_FIND(fict_tree, &vm_phys_fictitious_tree, &tmp); | ||||
rw_runlock(&vm_phys_fictitious_reg_lock); | rw_runlock(&vm_phys_fictitious_reg_lock); | ||||
if (seg == NULL) | if (seg == NULL) | ||||
return (NULL); | return (NULL); | ||||
m = &seg->first_page[atop(pa - seg->start)]; | m = &seg->first_page[atop(pa - seg->start)]; | ||||
KASSERT((m->flags & PG_FICTITIOUS) != 0, ("%p not fictitious", m)); | KASSERT((m->flags & PG_FICTITIOUS) != 0, ("%p not fictitious", m)); | ||||
if (cnt_after != NULL) | |||||
*cnt_after = atop(seg->end - pa); | |||||
return (m); | return (m); | ||||
} | } | ||||
static inline void | static inline void | ||||
vm_phys_fictitious_init_range(vm_page_t range, vm_paddr_t start, | vm_phys_fictitious_init_range(vm_page_t range, vm_paddr_t start, | ||||
long page_count, vm_memattr_t memattr) | long page_count, vm_memattr_t memattr) | ||||
{ | { | ||||
long i; | long i; | ||||
▲ Show 20 Lines • Show All 848 Lines • Show Last 20 Lines |