160727d8bSWarner Losh /*- 2796df753SPedro F. Giffuni * SPDX-License-Identifier: (BSD-3-Clause AND MIT-CMU) 351369649SPedro F. Giffuni * 4df8bae1dSRodney W. Grimes * Copyright (c) 1991, 1993 5df8bae1dSRodney W. Grimes * The Regents of the University of California. All rights reserved. 6df8bae1dSRodney W. Grimes * 7df8bae1dSRodney W. Grimes * This code is derived from software contributed to Berkeley by 8df8bae1dSRodney W. Grimes * The Mach Operating System project at Carnegie-Mellon University. 9df8bae1dSRodney W. Grimes * 10df8bae1dSRodney W. Grimes * Redistribution and use in source and binary forms, with or without 11df8bae1dSRodney W. Grimes * modification, are permitted provided that the following conditions 12df8bae1dSRodney W. Grimes * are met: 13df8bae1dSRodney W. Grimes * 1. Redistributions of source code must retain the above copyright 14df8bae1dSRodney W. Grimes * notice, this list of conditions and the following disclaimer. 15df8bae1dSRodney W. Grimes * 2. Redistributions in binary form must reproduce the above copyright 16df8bae1dSRodney W. Grimes * notice, this list of conditions and the following disclaimer in the 17df8bae1dSRodney W. Grimes * documentation and/or other materials provided with the distribution. 18fbbd9655SWarner Losh * 3. Neither the name of the University nor the names of its contributors 19df8bae1dSRodney W. Grimes * may be used to endorse or promote products derived from this software 20df8bae1dSRodney W. Grimes * without specific prior written permission. 21df8bae1dSRodney W. Grimes * 22df8bae1dSRodney W. Grimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23df8bae1dSRodney W. Grimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24df8bae1dSRodney W. Grimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25df8bae1dSRodney W. Grimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26df8bae1dSRodney W. Grimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27df8bae1dSRodney W. Grimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28df8bae1dSRodney W. Grimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29df8bae1dSRodney W. Grimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30df8bae1dSRodney W. Grimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31df8bae1dSRodney W. Grimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32df8bae1dSRodney W. Grimes * SUCH DAMAGE. 33df8bae1dSRodney W. Grimes * 34df8bae1dSRodney W. Grimes * 35df8bae1dSRodney W. Grimes * Copyright (c) 1987, 1990 Carnegie-Mellon University. 36df8bae1dSRodney W. Grimes * All rights reserved. 37df8bae1dSRodney W. Grimes * 38df8bae1dSRodney W. Grimes * Authors: Avadis Tevanian, Jr., Michael Wayne Young 39df8bae1dSRodney W. Grimes * 40df8bae1dSRodney W. Grimes * Permission to use, copy, modify and distribute this software and 41df8bae1dSRodney W. Grimes * its documentation is hereby granted, provided that both the copyright 42df8bae1dSRodney W. Grimes * notice and this permission notice appear in all copies of the 43df8bae1dSRodney W. Grimes * software, derivative works or modified versions, and any portions 44df8bae1dSRodney W. Grimes * thereof, and that both notices appear in supporting documentation. 45df8bae1dSRodney W. Grimes * 46df8bae1dSRodney W. Grimes * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 47df8bae1dSRodney W. Grimes * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND 48df8bae1dSRodney W. Grimes * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 49df8bae1dSRodney W. Grimes * 50df8bae1dSRodney W. Grimes * Carnegie Mellon requests users of this software to return to 51df8bae1dSRodney W. Grimes * 52df8bae1dSRodney W. Grimes * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 53df8bae1dSRodney W. Grimes * School of Computer Science 54df8bae1dSRodney W. Grimes * Carnegie Mellon University 55df8bae1dSRodney W. Grimes * Pittsburgh PA 15213-3890 56df8bae1dSRodney W. Grimes * 57df8bae1dSRodney W. Grimes * any improvements or extensions that they make and grant Carnegie the 58df8bae1dSRodney W. Grimes * rights to redistribute these changes. 59df8bae1dSRodney W. Grimes */ 60df8bae1dSRodney W. Grimes 61df8bae1dSRodney W. Grimes /* 62df8bae1dSRodney W. Grimes * Machine independent virtual memory parameters. 63df8bae1dSRodney W. Grimes */ 64df8bae1dSRodney W. Grimes 65df8bae1dSRodney W. Grimes #ifndef _VM_PARAM_ 66df8bae1dSRodney W. Grimes #define _VM_PARAM_ 67df8bae1dSRodney W. Grimes 68df8bae1dSRodney W. Grimes #include <machine/vmparam.h> 69df8bae1dSRodney W. Grimes 70df8bae1dSRodney W. Grimes /* 71df8bae1dSRodney W. Grimes * CTL_VM identifiers 72df8bae1dSRodney W. Grimes */ 73f7550ecfSMatthew Dillon #define VM_TOTAL 1 /* struct vmtotal */ 74c4aa0a2eSDavid E. O'Brien #define VM_METER VM_TOTAL/* deprecated, use VM_TOTAL */ 75df8bae1dSRodney W. Grimes #define VM_LOADAVG 2 /* struct loadavg */ 7644f1c916SBryan Drewery #define VM_V_FREE_MIN 3 /* vm_cnt.v_free_min */ 7744f1c916SBryan Drewery #define VM_V_FREE_TARGET 4 /* vm_cnt.v_free_target */ 7844f1c916SBryan Drewery #define VM_V_FREE_RESERVED 5 /* vm_cnt.v_free_reserved */ 7944f1c916SBryan Drewery #define VM_V_INACTIVE_TARGET 6 /* vm_cnt.v_inactive_target */ 80d73ce4c6SMark Johnston #define VM_OBSOLETE_7 7 /* unused, formerly v_cache_min */ 81d73ce4c6SMark Johnston #define VM_OBSOLETE_8 8 /* unused, formerly v_cache_max */ 8244f1c916SBryan Drewery #define VM_V_PAGEOUT_FREE_MIN 9 /* vm_cnt.v_pageout_free_min */ 8323b5c8feSAndrey Zonov #define VM_OBSOLETE_10 10 /* pageout algorithm */ 8423b5c8feSAndrey Zonov #define VM_SWAPPING_ENABLED 11 /* swapping enabled */ 85be7d4ac5SEdward Tomasz Napierala #define VM_OVERCOMMIT 12 /* vm.overcommit */ 86be7d4ac5SEdward Tomasz Napierala #define VM_MAXID 13 /* number of valid vm ids */ 87df8bae1dSRodney W. Grimes 88df8bae1dSRodney W. Grimes /* 895c5c8fa8SThomas Moestl * Structure for swap device statistics 905c5c8fa8SThomas Moestl */ 9169921123SKonstantin Belousov #define XSWDEV_VERSION 2 925c5c8fa8SThomas Moestl struct xswdev { 935c5c8fa8SThomas Moestl u_int xsw_version; 94f3732fd1SPoul-Henning Kamp dev_t xsw_dev; 955c5c8fa8SThomas Moestl int xsw_flags; 965c5c8fa8SThomas Moestl int xsw_nblks; 975c5c8fa8SThomas Moestl int xsw_used; 985c5c8fa8SThomas Moestl }; 995c5c8fa8SThomas Moestl 1005c5c8fa8SThomas Moestl /* 101df8bae1dSRodney W. Grimes * Return values from the VM routines. 102df8bae1dSRodney W. Grimes */ 103df8bae1dSRodney W. Grimes #define KERN_SUCCESS 0 104df8bae1dSRodney W. Grimes #define KERN_INVALID_ADDRESS 1 105df8bae1dSRodney W. Grimes #define KERN_PROTECTION_FAILURE 2 106df8bae1dSRodney W. Grimes #define KERN_NO_SPACE 3 107df8bae1dSRodney W. Grimes #define KERN_INVALID_ARGUMENT 4 108df8bae1dSRodney W. Grimes #define KERN_FAILURE 5 109df8bae1dSRodney W. Grimes #define KERN_RESOURCE_SHORTAGE 6 110df8bae1dSRodney W. Grimes #define KERN_NOT_RECEIVER 7 111df8bae1dSRodney W. Grimes #define KERN_NO_ACCESS 8 112df08823dSKonstantin Belousov #define KERN_OUT_OF_BOUNDS 9 113*fcb04758SJeff Roberson #define KERN_RESTART 10 114df8bae1dSRodney W. Grimes 1152965a453SKip Macy #ifndef PA_LOCK_COUNT 1162965a453SKip Macy #ifdef SMP 1172965a453SKip Macy #define PA_LOCK_COUNT 32 1182965a453SKip Macy #else 1192965a453SKip Macy #define PA_LOCK_COUNT 1 1202965a453SKip Macy #endif /* !SMP */ 1212965a453SKip Macy #endif /* !PA_LOCK_COUNT */ 1222965a453SKip Macy 1230b26119bSJeff Roberson #ifndef KSTACK_MAX_PAGES 1240b26119bSJeff Roberson #define KSTACK_MAX_PAGES 32 1250b26119bSJeff Roberson #endif 1260b26119bSJeff Roberson 12721943937SJeff Roberson #ifndef PHYS_AVAIL_ENTRIES 12821943937SJeff Roberson #define PHYS_AVAIL_ENTRIES (VM_PHYSSEG_MAX * 2) 12921943937SJeff Roberson #endif 13021943937SJeff Roberson #define PHYS_AVAIL_COUNT (PHYS_AVAIL_ENTRIES + 2) 13121943937SJeff Roberson 132df8bae1dSRodney W. Grimes #ifndef ASSEMBLER 133c4473420SPeter Wemm #ifdef _KERNEL 134df8bae1dSRodney W. Grimes #define num_pages(x) \ 135df8bae1dSRodney W. Grimes ((vm_offset_t)((((vm_offset_t)(x)) + PAGE_MASK) >> PAGE_SHIFT)) 1367419d1e2SDag-Erling Smørgrav extern unsigned long maxtsiz; 1377419d1e2SDag-Erling Smørgrav extern unsigned long dfldsiz; 1387419d1e2SDag-Erling Smørgrav extern unsigned long maxdsiz; 1397419d1e2SDag-Erling Smørgrav extern unsigned long dflssiz; 1407419d1e2SDag-Erling Smørgrav extern unsigned long maxssiz; 1417419d1e2SDag-Erling Smørgrav extern unsigned long sgrowsiz; 142c4473420SPeter Wemm #endif /* _KERNEL */ 143df8bae1dSRodney W. Grimes #endif /* ASSEMBLER */ 144df8bae1dSRodney W. Grimes #endif /* _VM_PARAM_ */ 145