1 /*- 2 * SPDX-License-Identifier: (BSD-3-Clause AND MIT-CMU) 3 * 4 * Copyright (c) 1991, 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * This code is derived from software contributed to Berkeley by 8 * The Mach Operating System project at Carnegie-Mellon University. 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions 12 * are met: 13 * 1. Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer. 15 * 2. Redistributions in binary form must reproduce the above copyright 16 * notice, this list of conditions and the following disclaimer in the 17 * documentation and/or other materials provided with the distribution. 18 * 3. Neither the name of the University nor the names of its contributors 19 * may be used to endorse or promote products derived from this software 20 * without specific prior written permission. 21 * 22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 * 34 * 35 * Copyright (c) 1987, 1990 Carnegie-Mellon University. 36 * All rights reserved. 37 * 38 * Authors: Avadis Tevanian, Jr., Michael Wayne Young 39 * 40 * Permission to use, copy, modify and distribute this software and 41 * its documentation is hereby granted, provided that both the copyright 42 * notice and this permission notice appear in all copies of the 43 * software, derivative works or modified versions, and any portions 44 * thereof, and that both notices appear in supporting documentation. 45 * 46 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 47 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND 48 * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 49 * 50 * Carnegie Mellon requests users of this software to return to 51 * 52 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 53 * School of Computer Science 54 * Carnegie Mellon University 55 * Pittsburgh PA 15213-3890 56 * 57 * any improvements or extensions that they make and grant Carnegie the 58 * rights to redistribute these changes. 59 */ 60 61 /* 62 * Machine independent virtual memory parameters. 63 */ 64 65 #ifndef _VM_PARAM_ 66 #define _VM_PARAM_ 67 68 #include <machine/vmparam.h> 69 70 /* 71 * CTL_VM identifiers 72 */ 73 #define VM_TOTAL 1 /* struct vmtotal */ 74 #define VM_METER VM_TOTAL/* deprecated, use VM_TOTAL */ 75 #define VM_LOADAVG 2 /* struct loadavg */ 76 #define VM_V_FREE_MIN 3 /* vm_cnt.v_free_min */ 77 #define VM_V_FREE_TARGET 4 /* vm_cnt.v_free_target */ 78 #define VM_V_FREE_RESERVED 5 /* vm_cnt.v_free_reserved */ 79 #define VM_V_INACTIVE_TARGET 6 /* vm_cnt.v_inactive_target */ 80 #define VM_OBSOLETE_7 7 /* unused, formerly v_cache_min */ 81 #define VM_OBSOLETE_8 8 /* unused, formerly v_cache_max */ 82 #define VM_V_PAGEOUT_FREE_MIN 9 /* vm_cnt.v_pageout_free_min */ 83 #define VM_OBSOLETE_10 10 /* pageout algorithm */ 84 #define VM_SWAPPING_ENABLED 11 /* swapping enabled */ 85 #define VM_OVERCOMMIT 12 /* vm.overcommit */ 86 #define VM_MAXID 13 /* number of valid vm ids */ 87 88 /* 89 * Structure for swap device statistics 90 */ 91 #define XSWDEV_VERSION 2 92 struct xswdev { 93 u_int xsw_version; 94 dev_t xsw_dev; 95 int xsw_flags; 96 int xsw_nblks; 97 int xsw_used; 98 }; 99 100 /* 101 * Return values from the VM routines. 102 */ 103 #define KERN_SUCCESS 0 104 #define KERN_INVALID_ADDRESS 1 105 #define KERN_PROTECTION_FAILURE 2 106 #define KERN_NO_SPACE 3 107 #define KERN_INVALID_ARGUMENT 4 108 #define KERN_FAILURE 5 109 #define KERN_RESOURCE_SHORTAGE 6 110 #define KERN_NOT_RECEIVER 7 111 #define KERN_NO_ACCESS 8 112 #define KERN_OUT_OF_BOUNDS 9 113 #define KERN_RESTART 10 114 115 #ifndef PA_LOCK_COUNT 116 #ifdef SMP 117 #define PA_LOCK_COUNT 32 118 #else 119 #define PA_LOCK_COUNT 1 120 #endif /* !SMP */ 121 #endif /* !PA_LOCK_COUNT */ 122 123 #ifndef KSTACK_MAX_PAGES 124 #define KSTACK_MAX_PAGES 32 125 #endif 126 127 #ifndef PHYS_AVAIL_ENTRIES 128 #define PHYS_AVAIL_ENTRIES (VM_PHYSSEG_MAX * 2) 129 #endif 130 #define PHYS_AVAIL_COUNT (PHYS_AVAIL_ENTRIES + 2) 131 132 #ifndef ASSEMBLER 133 #ifdef _KERNEL 134 #define num_pages(x) \ 135 ((vm_offset_t)((((vm_offset_t)(x)) + PAGE_MASK) >> PAGE_SHIFT)) 136 extern unsigned long maxtsiz; 137 extern unsigned long dfldsiz; 138 extern unsigned long maxdsiz; 139 extern unsigned long dflssiz; 140 extern unsigned long maxssiz; 141 extern unsigned long sgrowsiz; 142 #endif /* _KERNEL */ 143 #endif /* ASSEMBLER */ 144 #endif /* _VM_PARAM_ */ 145