xref: /openbsd/sys/arch/sh/include/vmparam.h (revision 404b540a)
1 /*	$OpenBSD: vmparam.h,v 1.7 2008/08/22 10:41:37 kurt Exp $	*/
2 /*	$NetBSD: vmparam.h,v 1.17 2006/03/04 01:55:03 uwe Exp $	*/
3 
4 /*-
5  * Copyright (c) 2002 The NetBSD Foundation, Inc.
6  * All rights reserved.
7  *
8  * This code is derived from software contributed to The NetBSD Foundation
9  * by UCHIYAMA Yasushi.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions and the following disclaimer.
16  * 2. Redistributions in binary form must reproduce the above copyright
17  *    notice, this list of conditions and the following disclaimer in the
18  *    documentation and/or other materials provided with the distribution.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30  * POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #ifndef _SH_VMPARAM_H_
34 #define	_SH_VMPARAM_H_
35 #include <sys/queue.h>
36 
37 /* Virtual address map. */
38 #define	VM_MIN_ADDRESS		((vaddr_t)PAGE_SIZE)
39 #define	VM_MAXUSER_ADDRESS	((vaddr_t)0x7ffff000)
40 #define	VM_MAX_ADDRESS		((vaddr_t)0x7ffff000)
41 #define	VM_MIN_KERNEL_ADDRESS	((vaddr_t)0xc0000000)
42 #define	VM_MAX_KERNEL_ADDRESS	((vaddr_t)0xe0000000)
43 
44 /* map PIE below 4MB (non-pie link address) to avoid mmap pressure */
45 #define VM_PIE_MIN_ADDR		PAGE_SIZE
46 #define VM_PIE_MAX_ADDR		0x400000UL
47 
48 /* top of stack */
49 #define	USRSTACK		VM_MAXUSER_ADDRESS
50 
51 /* Virtual memory resource limit. */
52 #define	MAXTSIZ			(64 * 1024 * 1024)	/* max text size */
53 #ifndef MAXDSIZ
54 #define	MAXDSIZ			(512 * 1024 * 1024)	/* max data size */
55 #endif
56 #ifndef	MAXSSIZ
57 #define	MAXSSIZ			(32 * 1024 * 1024)	/* max stack size */
58 #endif
59 
60 /* initial data size limit */
61 #ifndef DFLDSIZ
62 #define	DFLDSIZ			(128 * 1024 * 1024)
63 #endif
64 /* initial stack size limit */
65 #ifndef	DFLSSIZ
66 #define	DFLSSIZ			(2 * 1024 * 1024)
67 #endif
68 
69 #define	STACKGAP_RANDOM		(256 * 1024)
70 
71 /*
72  * Size of shared memory map
73  */
74 #ifndef SHMMAXPGS
75 #define	SHMMAXPGS		1024
76 #endif
77 
78 /* Size of user raw I/O map */
79 #ifndef USRIOSIZE
80 #define	USRIOSIZE		(MAXBSIZE / PAGE_SIZE * 8)
81 #endif
82 
83 #define	VM_PHYS_SIZE		(USRIOSIZE * PAGE_SIZE)
84 
85 /* pmap-specific data store in the vm_page structure. */
86 #define	__HAVE_VM_PAGE_MD
87 #define	PVH_REFERENCED		1
88 #define	PVH_MODIFIED		2
89 
90 #ifndef _LOCORE
91 struct pv_entry;
92 struct vm_page_md {
93 	SLIST_HEAD(, pv_entry) pvh_head;
94 	int pvh_flags;
95 };
96 
97 #define	VM_MDPAGE_INIT(pg)						\
98 do {									\
99 	struct vm_page_md *pvh = &(pg)->mdpage;				\
100 	SLIST_INIT(&pvh->pvh_head);					\
101 	pvh->pvh_flags = 0;						\
102 } while (/*CONSTCOND*/0)
103 #endif /* _LOCORE */
104 #endif /* !_SH_VMPARAM_H_ */
105