xref: /netbsd-src/sys/arch/sh3/include/vmparam.h (revision 88fcb00c0357f2d7c1774f86a352637bfda96184)
1 /*	$NetBSD: vmparam.h,v 1.21 2010/11/14 13:33:22 uebayasi Exp $	*/
2 
3 /*-
4  * Copyright (c) 2002 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by UCHIYAMA Yasushi.
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  *
19  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 #ifndef _SH3_VMPARAM_H_
33 #define	_SH3_VMPARAM_H_
34 #include <sys/queue.h>
35 
36 /*
37  * We use 4K pages on the sh3/sh4.  Override the PAGE_* definitions
38  * to be compile-time constants.
39  */
40 #define	PAGE_SHIFT	12
41 #define	PAGE_SIZE	(1 << PAGE_SHIFT)
42 #define	PAGE_MASK	(PAGE_SIZE - 1)
43 
44 /* Virtual address map. */
45 #define	VM_MIN_ADDRESS		((vaddr_t)0)
46 #define	VM_MAXUSER_ADDRESS	((vaddr_t)0x7ffff000)
47 #define	VM_MAX_ADDRESS		((vaddr_t)0x7ffff000)
48 #define	VM_MIN_KERNEL_ADDRESS	((vaddr_t)0xc0000000)
49 #define	VM_MAX_KERNEL_ADDRESS	((vaddr_t)0xe0000000)
50 
51 /* top of stack */
52 #define	USRSTACK		VM_MAXUSER_ADDRESS
53 
54 /* Virtual memory resoruce limit. */
55 #define	MAXTSIZ			(64 * 1024 * 1024)	/* max text size */
56 #ifndef MAXDSIZ
57 #define	MAXDSIZ			(512 * 1024 * 1024)	/* max data size */
58 #endif
59 #ifndef	MAXSSIZ
60 #define	MAXSSIZ			(32 * 1024 * 1024)	/* max stack size */
61 #endif
62 
63 /* initial data size limit */
64 #ifndef DFLDSIZ
65 #define	DFLDSIZ			(128 * 1024 * 1024)
66 #endif
67 /* initial stack size limit */
68 #ifndef	DFLSSIZ
69 #define	DFLSSIZ			(2 * 1024 * 1024)
70 #endif
71 
72 /* Size of user raw I/O map */
73 #ifndef USRIOSIZE
74 #define	USRIOSIZE		(MAXBSIZE / PAGE_SIZE * 8)
75 #endif
76 
77 #define	VM_PHYS_SIZE		(USRIOSIZE * PAGE_SIZE)
78 
79 /* Physical memory segments */
80 #define	VM_PHYSSEG_STRAT	VM_PSTRAT_BSEARCH
81 
82 #define	sh3_round_page(x)	((((uint32_t)(x)) + PGOFSET) & ~PGOFSET)
83 #define	sh3_trunc_page(x)	((uint32_t)(x) & ~PGOFSET)
84 #define	sh3_btop(x)		((uint32_t)(x) >> PGSHIFT)
85 #define	sh3_ptob(x)		((uint32_t)(x) << PGSHIFT)
86 #endif /* !_SH3_VMPARAM_H_ */
87