Lines Matching +full:page +full:- +full:offset

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
80 * Offset should be page aligned. in sg_pager_alloc()
86 * The scatter/gather list must only include page-aligned in sg_pager_alloc()
91 for (i = 0; i < sg->sg_nseg; i++) { in sg_pager_alloc()
92 if ((sg->sg_segs[i].ss_paddr % PAGE_SIZE) != 0 || in sg_pager_alloc()
93 (sg->sg_segs[i].ss_len % PAGE_SIZE) != 0) in sg_pager_alloc()
95 npages += sg->sg_segs[i].ss_len / PAGE_SIZE; in sg_pager_alloc()
117 object->handle = sglist_hold(sg); in sg_pager_alloc()
118 TAILQ_INIT(&object->un_pager.sgp.sgp_pglist); in sg_pager_alloc()
131 while ((m = TAILQ_FIRST(&object->un_pager.sgp.sgp_pglist)) != 0) { in sg_pager_dealloc()
134 TAILQ_REMOVE(&object->un_pager.sgp.sgp_pglist, m, plinks.q); in sg_pager_dealloc()
138 sg = object->handle; in sg_pager_dealloc()
140 object->handle = NULL; in sg_pager_dealloc()
141 object->type = OBJT_DEAD; in sg_pager_dealloc()
149 vm_page_t m_paddr, page; in sg_pager_getpages() local
150 vm_pindex_t offset; in sg_pager_getpages() local
159 sg = object->handle; in sg_pager_getpages()
160 memattr = object->memattr; in sg_pager_getpages()
161 offset = m[0]->pindex; in sg_pager_getpages()
164 * Lookup the physical address of the requested page. An initial in sg_pager_getpages()
166 * page is found since '0' can be a valid page-aligned physical in sg_pager_getpages()
171 for (i = 0; i < sg->sg_nseg; i++) { in sg_pager_getpages()
172 if (space + sg->sg_segs[i].ss_len <= (offset * PAGE_SIZE)) { in sg_pager_getpages()
173 space += sg->sg_segs[i].ss_len; in sg_pager_getpages()
176 paddr = sg->sg_segs[i].ss_paddr + offset * PAGE_SIZE - space; in sg_pager_getpages()
179 KASSERT(paddr != 1, ("invalid SG page index")); in sg_pager_getpages()
181 /* If "paddr" is a real page, perform a sanity check on "memattr". */ in sg_pager_getpages()
189 /* Return a fake page for the requested page. */ in sg_pager_getpages()
190 KASSERT(!(m[0]->flags & PG_FICTITIOUS), in sg_pager_getpages()
191 ("backing page for SG is fake")); in sg_pager_getpages()
193 /* Construct a new fake page. */ in sg_pager_getpages()
194 page = vm_page_getfake(paddr, memattr); in sg_pager_getpages()
196 TAILQ_INSERT_TAIL(&object->un_pager.sgp.sgp_pglist, page, plinks.q); in sg_pager_getpages()
197 vm_page_replace(page, object, offset, m[0]); in sg_pager_getpages()
199 m[0] = page; in sg_pager_getpages()
200 vm_page_valid(page); in sg_pager_getpages()