* 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
| 253 | * wired rather than the object field, which is used. |
| 254 | */ |
| 255 | static u_long * |
| 256 | v2sizep(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 | |
| 270 | static u_long * |
| 271 | v2sizev(vm_offset_t va) |
no test coverage detected