memguard.c (5df87b21d3fc592f112c1721d9c2d533d4411ae4) memguard.c (c325e866f4c58f7804884581b999849982b2abd6)
1/*-
2 * Copyright (c) 2005, Bosko Milekic <bmilekic@FreeBSD.org>.
3 * Copyright (c) 2010 Isilon Systems, Inc. (http://www.isilon.com/)
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 247 unchanged lines hidden (view full) ---

256 struct vm_page *p;
257
258 pa = pmap_kextract(va);
259 if (pa == 0)
260 panic("MemGuard detected double-free of %p", (void *)va);
261 p = PHYS_TO_VM_PAGE(pa);
262 KASSERT(p->wire_count != 0 && p->queue == PQ_NONE,
263 ("MEMGUARD: Expected wired page %p in vtomgfifo!", p));
1/*-
2 * Copyright (c) 2005, Bosko Milekic <bmilekic@FreeBSD.org>.
3 * Copyright (c) 2010 Isilon Systems, Inc. (http://www.isilon.com/)
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 247 unchanged lines hidden (view full) ---

256 struct vm_page *p;
257
258 pa = pmap_kextract(va);
259 if (pa == 0)
260 panic("MemGuard detected double-free of %p", (void *)va);
261 p = PHYS_TO_VM_PAGE(pa);
262 KASSERT(p->wire_count != 0 && p->queue == PQ_NONE,
263 ("MEMGUARD: Expected wired page %p in vtomgfifo!", p));
264 return ((u_long *)&p->pageq.tqe_next);
264 return (&p->plinks.memguard.p);
265}
266
267static u_long *
268v2sizev(vm_offset_t va)
269{
270 vm_paddr_t pa;
271 struct vm_page *p;
272
273 pa = pmap_kextract(va);
274 if (pa == 0)
275 panic("MemGuard detected double-free of %p", (void *)va);
276 p = PHYS_TO_VM_PAGE(pa);
277 KASSERT(p->wire_count != 0 && p->queue == PQ_NONE,
278 ("MEMGUARD: Expected wired page %p in vtomgfifo!", p));
265}
266
267static u_long *
268v2sizev(vm_offset_t va)
269{
270 vm_paddr_t pa;
271 struct vm_page *p;
272
273 pa = pmap_kextract(va);
274 if (pa == 0)
275 panic("MemGuard detected double-free of %p", (void *)va);
276 p = PHYS_TO_VM_PAGE(pa);
277 KASSERT(p->wire_count != 0 && p->queue == PQ_NONE,
278 ("MEMGUARD: Expected wired page %p in vtomgfifo!", p));
279 return ((u_long *)&p->pageq.tqe_prev);
279 return (&p->plinks.memguard.v);
280}
281
282/*
283 * Allocate a single object of specified size with specified flags
284 * (either M_WAITOK or M_NOWAIT).
285 */
286void *
287memguard_alloc(unsigned long req_size, int flags)

--- 231 unchanged lines hidden ---
280}
281
282/*
283 * Allocate a single object of specified size with specified flags
284 * (either M_WAITOK or M_NOWAIT).
285 */
286void *
287memguard_alloc(unsigned long req_size, int flags)

--- 231 unchanged lines hidden ---