vmparam.h revision 1.40
1/*	$NetBSD: vmparam.h,v 1.40 2009/03/06 20:31:52 joerg Exp $ */
2
3/*
4 * Copyright (c) 1992, 1993
5 *	The Regents of the University of California.  All rights reserved.
6 *
7 * This software was developed by the Computer Systems Engineering group
8 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
9 * contributed to Berkeley.
10 *
11 * All advertising materials mentioning features or use of this software
12 * must display the following acknowledgement:
13 *	This product includes software developed by the University of
14 *	California, Lawrence Berkeley Laboratory.
15 *
16 * Redistribution and use in source and binary forms, with or without
17 * modification, are permitted provided that the following conditions
18 * are met:
19 * 1. Redistributions of source code must retain the above copyright
20 *    notice, this list of conditions and the following disclaimer.
21 * 2. Redistributions in binary form must reproduce the above copyright
22 *    notice, this list of conditions and the following disclaimer in the
23 *    documentation and/or other materials provided with the distribution.
24 * 3. Neither the name of the University nor the names of its contributors
25 *    may be used to endorse or promote products derived from this software
26 *    without specific prior written permission.
27 *
28 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
29 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
32 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
37 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 * SUCH DAMAGE.
39 *
40 *	@(#)vmparam.h	8.1 (Berkeley) 6/11/93
41 */
42
43#ifndef _SPARC_VMPARAM_H_
44#define _SPARC_VMPARAM_H_
45
46/*
47 * Machine dependent constants for SPARC
48 */
49
50#include <machine/cpuconf.h>
51
52/*
53 * Sun4 systems have a 8K page size.  All other platforms have a
54 * 4K page size.  We need to define these upper and lower limits
55 * for machine-independent code.  We also try to make PAGE_SIZE,
56 * PAGE_SHIFT, and PAGE_MASK into compile-time constants, if we can.
57 *
58 * XXX Should garbage-collect the version of this from <machine/param.h>.
59 */
60#define	PAGE_SHIFT_SUN4		13
61#define	PAGE_SHIFT_SUN4CM	12
62
63#define	MIN_PAGE_SIZE		(1 << PAGE_SHIFT_SUN4CM)
64#define	MAX_PAGE_SIZE		(1 << PAGE_SHIFT_SUN4)
65
66#if CPU_NTYPES != 0 && !defined(SUN4)
67#define	PAGE_SHIFT		PAGE_SHIFT_SUN4CM
68#define	PAGE_SIZE		(1 << PAGE_SHIFT)
69#define	PAGE_MASK		(PAGE_SIZE - 1)
70#elif CPU_NTYPES == 1 && defined(SUN4)
71#define	PAGE_SHIFT		PAGE_SHIFT_SUN4
72#define	PAGE_SIZE		(1 << PAGE_SHIFT)
73#define	PAGE_MASK		(PAGE_SIZE - 1)
74#endif
75
76/*
77 * USRSTACK is the top (end) of the user stack.
78 */
79#define	USRSTACK	KERNBASE		/* Start of user stack */
80
81/*
82 * Virtual memory related constants, all in bytes
83 */
84#ifndef MAXTSIZ
85#define	MAXTSIZ		(64*1024*1024)		/* max text size */
86#endif
87#ifndef DFLDSIZ
88#define	DFLDSIZ		(64*1024*1024)		/* initial data size limit */
89#endif
90#ifndef MAXDSIZ
91#define	MAXDSIZ		(512*1024*1024)		/* max data size */
92#endif
93#ifndef	DFLSSIZ
94#define	DFLSSIZ		(8*1024*1024)		/* initial stack size limit */
95#endif
96#ifndef	MAXSSIZ
97#define	MAXSSIZ		(32*1024*1024)		/* max stack size */
98#endif
99
100/*
101 * Mach derived constants
102 */
103
104/*
105 * User/kernel map constants.  Note that sparc/vaddrs.h defines the
106 * IO space virtual base, which must be the same as VM_MAX_KERNEL_ADDRESS:
107 * tread with care.
108 */
109#define VM_MIN_ADDRESS		((vaddr_t)0)
110#define VM_MAX_ADDRESS		((vaddr_t)KERNBASE)
111#define VM_MAXUSER_ADDRESS	((vaddr_t)KERNBASE)
112#define VM_MIN_KERNEL_ADDRESS	((vaddr_t)KERNBASE)
113#define VM_MAX_KERNEL_ADDRESS   ((vaddr_t)KERNEND)
114
115#define VM_PHYSSEG_MAX		32       /* up to 32 segments */
116#define VM_PHYSSEG_STRAT	VM_PSTRAT_BSEARCH
117#define VM_PHYSSEG_NOADD		/* can't add RAM after vm_mem_init */
118
119#define	VM_NFREELIST		1
120#define	VM_FREELIST_DEFAULT	0
121
122#define __HAVE_VM_PAGE_MD
123
124/*
125 * For each managed physical page, there is a list of all currently
126 * valid virtual mappings of that page.  Since there is usually one
127 * (or zero) mapping per page, the table begins with an initial entry,
128 * rather than a pointer; this head entry is empty iff its pv_pmap
129 * field is NULL.
130 */
131struct vm_page_md {
132	struct pvlist {
133		struct	pvlist *pv_next;	/* next pvlist, if any */
134		struct	pmap *pv_pmap;		/* pmap of this va */
135		vaddr_t	pv_va;			/* virtual address */
136		int	pv_flags;		/* flags (below) */
137	} pvlisthead;
138};
139#define VM_MDPAGE_PVHEAD(pg)	(&(pg)->mdpage.pvlisthead)
140
141#define VM_MDPAGE_INIT(pg) do {				\
142	(pg)->mdpage.pvlisthead.pv_next = NULL;		\
143	(pg)->mdpage.pvlisthead.pv_pmap = NULL;		\
144	(pg)->mdpage.pvlisthead.pv_va = 0;		\
145	(pg)->mdpage.pvlisthead.pv_flags = 0;		\
146} while(/*CONSTCOND*/0)
147
148#endif /* _SPARC_VMPARAM_H_ */
149