MCPcopy Create free account
hub / github.com/F-Stack/f-stack / v2sizep

Function v2sizep

freebsd/vm/memguard.c:255–268  ·  view source on GitHub ↗

* v2sizep() converts a virtual address of the first page allocated for * an item to a pointer to u_long recording the size of the original * allocation request. * * This routine is very similar to those defined by UMA in uma_int.h. * The difference is that this routine stores the originally allocated * size in one of the page's fields that is unused when the page is * wired rather than the

Source from the content-addressed store, hash-verified

253 * wired rather than the object field, which is used.
254 */
255static u_long *
256v2sizep(vm_offset_t va)
257{
258 vm_paddr_t pa;
259 struct vm_page *p;
260
261 pa = pmap_kextract(va);
262 if (pa == 0)
263 panic("MemGuard detected double-free of %p", (void *)va);
264 p = PHYS_TO_VM_PAGE(pa);
265 KASSERT(vm_page_wired(p) && p->a.queue == PQ_NONE,
266 ("MEMGUARD: Expected wired page %p in vtomgfifo!", p));
267 return (&p->plinks.memguard.p);
268}
269
270static u_long *
271v2sizev(vm_offset_t va)

Callers 4

memguard_allocFunction · 0.85
memguard_freeFunction · 0.85
memguard_reallocFunction · 0.85
memguard_get_req_sizeFunction · 0.85

Calls 4

PHYS_TO_VM_PAGEFunction · 0.85
vm_page_wiredFunction · 0.85
pmap_kextractFunction · 0.50
panicFunction · 0.50

Tested by

no test coverage detected