1279377Simp/*- 2279377Simp * Copyright (c) 2005, 3279377Simp * Bosko Milekic <bmilekic@FreeBSD.org>. All rights reserved. 4279377Simp * 5279377Simp * Redistribution and use in source and binary forms, with or without 6279377Simp * modification, are permitted provided that the following conditions 7279377Simp * are met: 8279377Simp * 1. Redistributions of source code must retain the above copyright 9279377Simp * notice unmodified, this list of conditions, and the following 10279377Simp * disclaimer. 11279377Simp * 2. Redistributions in binary form must reproduce the above copyright 12279377Simp * notice, this list of conditions and the following disclaimer in the 13279377Simp * documentation and/or other materials provided with the distribution. 14279377Simp * 15279377Simp * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16279377Simp * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17279377Simp * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18279377Simp * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19279377Simp * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20279377Simp * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21279377Simp * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22279377Simp * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23279377Simp * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24279377Simp * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25279377Simp * 26279377Simp * $FreeBSD$ 27279377Simp */ 28279377Simp 29279377Simp#ifndef _VM_MEMGUARD_H_ 30279377Simp#define _VM_MEMGUARD_H_ 31279377Simp 32279377Simp#include "opt_vm.h" 33279377Simp 34279377Simpstruct malloc_type; 35279377Simpstruct vm_map; 36279377Simpstruct vmem; 37279377Simp 38279377Simp#ifdef DEBUG_MEMGUARD 39279377Simpunsigned long memguard_fudge(unsigned long, const struct vm_map *); 40279377Simpvoid memguard_init(struct vmem *); 41279377Simpvoid *memguard_alloc(unsigned long, int); 42279377Simpvoid *memguard_realloc(void *, unsigned long, struct malloc_type *, int); 43279377Simpvoid memguard_free(void *); 44279377Simpint memguard_cmp_mtp(struct malloc_type *, unsigned long); 45279377Simpint memguard_cmp_zone(uma_zone_t); 46279377Simpint is_memguard_addr(void *); 47279377Simp#else 48279377Simp#define memguard_fudge(size, xxx) (size) 49279377Simp#define memguard_init(map) do { } while (0) 50279377Simp#define memguard_alloc(size, flags) NULL 51279377Simp#define memguard_realloc(a, s, mtp, f) NULL 52279377Simp#define memguard_free(addr) do { } while (0) 53279377Simp#define memguard_cmp_mtp(mtp, size) 0 54279377Simp#define memguard_cmp_zone(zone) 0 55279377Simp#define is_memguard_addr(addr) 0 56279377Simp#endif 57279377Simp 58279377Simp#endif /* _VM_MEMGUARD_H_ */ 59279377Simp