Home | History | Annotate | Line # | Download | only in include
vmparam.h revision 1.55
      1  1.55      matt /*	$NetBSD: vmparam.h,v 1.55 2016/07/11 16:15:35 matt Exp $	*/
      2   1.5       cgd 
      3   1.1   deraadt /*
      4  1.47     rmind  * Copyright (c) 1988 University of Utah.
      5   1.2     glass  * Copyright (c) 1992, 1993
      6   1.2     glass  *	The Regents of the University of California.  All rights reserved.
      7  1.33       agc  *
      8  1.33       agc  * This code is derived from software contributed to Berkeley by
      9  1.33       agc  * the Systems Programming Group of the University of Utah Computer
     10  1.33       agc  * Science Department and Ralph Campbell.
     11  1.33       agc  *
     12  1.33       agc  * Redistribution and use in source and binary forms, with or without
     13  1.33       agc  * modification, are permitted provided that the following conditions
     14  1.33       agc  * are met:
     15  1.33       agc  * 1. Redistributions of source code must retain the above copyright
     16  1.33       agc  *    notice, this list of conditions and the following disclaimer.
     17  1.33       agc  * 2. Redistributions in binary form must reproduce the above copyright
     18  1.33       agc  *    notice, this list of conditions and the following disclaimer in the
     19  1.33       agc  *    documentation and/or other materials provided with the distribution.
     20  1.33       agc  * 3. Neither the name of the University nor the names of its contributors
     21  1.33       agc  *    may be used to endorse or promote products derived from this software
     22  1.33       agc  *    without specific prior written permission.
     23  1.33       agc  *
     24  1.33       agc  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     25  1.33       agc  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     26  1.33       agc  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     27  1.33       agc  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     28  1.33       agc  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     29  1.33       agc  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     30  1.33       agc  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     31  1.33       agc  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     32  1.33       agc  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     33  1.33       agc  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     34  1.33       agc  * SUCH DAMAGE.
     35  1.33       agc  *
     36  1.33       agc  * from: Utah Hdr: vmparam.h 1.16 91/01/18
     37  1.33       agc  *
     38  1.33       agc  *	@(#)vmparam.h	8.2 (Berkeley) 4/22/94
     39  1.33       agc  */
     40   1.1   deraadt 
     41  1.10   thorpej #ifndef _MIPS_VMPARAM_H_
     42  1.10   thorpej #define	_MIPS_VMPARAM_H_
     43  1.10   thorpej 
     44  1.48      matt #ifdef _KERNEL_OPT
     45  1.54      matt #include "opt_cputype.h"
     46  1.48      matt #include "opt_multiprocessor.h"
     47  1.54      matt #include "opt_modular.h"
     48  1.48      matt #endif
     49  1.48      matt 
     50   1.1   deraadt /*
     51  1.10   thorpej  * Machine dependent VM constants for MIPS.
     52   1.1   deraadt  */
     53  1.54      matt #if !defined(_RUMPKERNEL) && (defined(MODULAR) || defined(_MODULE))
     54  1.53      matt #define MAX_PAGE_SIZE	16384
     55  1.53      matt #define MIN_PAGE_SIZE	4096
     56  1.54      matt #endif
     57  1.25   thorpej 
     58  1.25   thorpej /*
     59  1.43      matt  * We normally use a 4K page but may use 16K on MIPS systems.
     60  1.43      matt  * Override PAGE_* definitions to compile-time constants.
     61  1.25   thorpej  */
     62  1.43      matt #ifdef ENABLE_MIPS_16KB_PAGE
     63  1.43      matt #define	PAGE_SHIFT	14
     64  1.55      matt #elif defined(ENABLE_MIPS_8KB_PAGE) \
     65  1.55      matt     || (!defined(ENABLE_MIPS_4KB_PAGE) && __mips >= 3)
     66  1.55      matt #define	PAGE_SHIFT	13
     67  1.55      matt #else /* defined(ENABLE_MIPS_4KB_PAGE) */
     68  1.25   thorpej #define	PAGE_SHIFT	12
     69  1.43      matt #endif
     70  1.25   thorpej #define	PAGE_SIZE	(1 << PAGE_SHIFT)
     71  1.25   thorpej #define	PAGE_MASK	(PAGE_SIZE - 1)
     72  1.10   thorpej 
     73   1.1   deraadt /*
     74  1.31   thorpej  * USRSTACK is the top (end) of the user stack.
     75  1.21     soren  *
     76  1.21     soren  * USRSTACK needs to start a little below 0x8000000 because the R8000
     77  1.21     soren  * and some QED CPUs perform some virtual address checks before the
     78  1.48      matt  * offset is calculated.  We use 0x8000 since that's the max displacement
     79  1.48      matt  * in an instruction.
     80   1.1   deraadt  */
     81  1.48      matt #define	USRSTACK	(VM_MAXUSER_ADDRESS-0x8000) /* Start of user stack */
     82  1.48      matt #define	USRSTACK32	((uint32_t)VM_MAXUSER32_ADDRESS-0x8000)
     83  1.26   tsutsui 
     84   1.1   deraadt /*
     85   1.1   deraadt  * Virtual memory related constants, all in bytes
     86   1.1   deraadt  */
     87  1.48      matt #if defined(__mips_o32)
     88   1.1   deraadt #ifndef MAXTSIZ
     89  1.29    simonb #define	MAXTSIZ		(64*1024*1024)		/* max text size */
     90   1.1   deraadt #endif
     91   1.1   deraadt #ifndef DFLDSIZ
     92  1.29    simonb #define	DFLDSIZ		(128*1024*1024)		/* initial data size limit */
     93   1.1   deraadt #endif
     94   1.1   deraadt #ifndef MAXDSIZ
     95  1.29    simonb #define	MAXDSIZ		(512*1024*1024)		/* max data size */
     96   1.1   deraadt #endif
     97   1.1   deraadt #ifndef	DFLSSIZ
     98  1.44      matt #define	DFLSSIZ		(4*1024*1024)		/* initial stack size limit */
     99   1.1   deraadt #endif
    100   1.1   deraadt #ifndef	MAXSSIZ
    101   1.6  jonathan #define	MAXSSIZ		(32*1024*1024)		/* max stack size */
    102   1.1   deraadt #endif
    103  1.48      matt #else
    104  1.48      matt /*
    105  1.48      matt  * 64-bit ABIs need more space.
    106  1.48      matt  */
    107  1.48      matt #ifndef MAXTSIZ
    108  1.48      matt #define	MAXTSIZ		(128*1024*1024)		/* max text size */
    109  1.48      matt #endif
    110  1.48      matt #ifndef DFLDSIZ
    111  1.48      matt #define	DFLDSIZ		(256*1024*1024)		/* initial data size limit */
    112  1.48      matt #endif
    113  1.48      matt #ifndef MAXDSIZ
    114  1.48      matt #define	MAXDSIZ		(1536*1024*1024)	/* max data size */
    115  1.48      matt #endif
    116  1.48      matt #ifndef	DFLSSIZ
    117  1.48      matt #define	DFLSSIZ		(16*1024*1024)		/* initial stack size limit */
    118  1.48      matt #endif
    119  1.48      matt #ifndef	MAXSSIZ
    120  1.48      matt #define	MAXSSIZ		(120*1024*1024)		/* max stack size */
    121  1.48      matt #endif
    122  1.48      matt #endif /* !__mips_o32 */
    123   1.1   deraadt 
    124   1.1   deraadt /*
    125  1.44      matt  * Virtual memory related constants, all in bytes
    126  1.44      matt  */
    127  1.44      matt #ifndef MAXTSIZ32
    128  1.44      matt #define	MAXTSIZ32	MAXTSIZ			/* max text size */
    129  1.44      matt #endif
    130  1.44      matt #ifndef DFLDSIZ32
    131  1.44      matt #define	DFLDSIZ32	DFLDSIZ			/* initial data size limit */
    132  1.44      matt #endif
    133  1.44      matt #ifndef MAXDSIZ32
    134  1.44      matt #define	MAXDSIZ32	MAXDSIZ			/* max data size */
    135  1.44      matt #endif
    136  1.44      matt #ifndef	DFLSSIZ32
    137  1.44      matt #define	DFLSSIZ32	DFLTSIZ			/* initial stack size limit */
    138  1.44      matt #endif
    139  1.44      matt #ifndef	MAXSSIZ32
    140  1.44      matt #define	MAXSSIZ32	MAXSSIZ			/* max stack size */
    141  1.44      matt #endif
    142  1.44      matt 
    143  1.44      matt /*
    144   1.1   deraadt  * PTEs for mapping user space into the kernel for phyio operations.
    145  1.24      soda  * The default PTE number is enough to cover 8 disks * MAXBSIZE.
    146   1.1   deraadt  */
    147   1.1   deraadt #ifndef USRIOSIZE
    148  1.32   thorpej #define USRIOSIZE	(MAXBSIZE/PAGE_SIZE * 8)
    149   1.1   deraadt #endif
    150   1.1   deraadt 
    151   1.1   deraadt /*
    152   1.1   deraadt  * Mach derived constants
    153   1.1   deraadt  */
    154   1.1   deraadt 
    155  1.44      matt /*
    156  1.44      matt  * user/kernel map constants
    157  1.44      matt  * These are negative addresses since MIPS addresses are signed.
    158  1.44      matt  */
    159  1.11  nisimura #define VM_MIN_ADDRESS		((vaddr_t)0x00000000)
    160  1.44      matt #ifdef _LP64
    161  1.50      matt #define MIPS_VM_MAXUSER_ADDRESS	((vaddr_t) 1L << (4*PGSHIFT-8))
    162  1.50      matt #ifdef ENABLE_MIPS_16KB_PAGE
    163  1.50      matt #define VM_MAXUSER_ADDRESS	mips_vm_maxuser_address
    164  1.50      matt #else
    165  1.50      matt #define VM_MAXUSER_ADDRESS	MIPS_VM_MAXUSER_ADDRESS
    166  1.50      matt #endif
    167  1.48      matt 							/* 0x0000010000000000 */
    168  1.44      matt #define VM_MAX_ADDRESS		VM_MAXUSER_ADDRESS
    169  1.44      matt #define VM_MIN_KERNEL_ADDRESS	((vaddr_t) 3L << 62)	/* 0xC000000000000000 */
    170  1.44      matt #define VM_MAX_KERNEL_ADDRESS	((vaddr_t) -1L << 31)	/* 0xFFFFFFFF80000000 */
    171  1.44      matt #else
    172  1.44      matt #define VM_MAXUSER_ADDRESS	((vaddr_t)-0x7fffffff-1)/* 0xFFFFFFFF80000000 */
    173  1.44      matt #define VM_MAX_ADDRESS		((vaddr_t)-0x7fffffff-1)/* 0xFFFFFFFF80000000 */
    174  1.44      matt #define VM_MIN_KERNEL_ADDRESS	((vaddr_t)-0x40000000)	/* 0xFFFFFFFFC0000000 */
    175  1.16       uch #ifdef ENABLE_MIPS_TX3900
    176  1.44      matt #define VM_MAX_KERNEL_ADDRESS	((vaddr_t)-0x01000000)	/* 0xFFFFFFFFFF000000 */
    177  1.16       uch #else
    178  1.44      matt #define VM_MAX_KERNEL_ADDRESS	((vaddr_t)-0x00004000)	/* 0xFFFFFFFFFFFFC000 */
    179  1.44      matt #endif
    180  1.16       uch #endif
    181  1.44      matt #define VM_MAXUSER32_ADDRESS	((vaddr_t)(1UL << 31))/* 0x0000000080000000 */
    182   1.1   deraadt 
    183  1.34    simonb /*
    184  1.34    simonb  * The address to which unspecified mapping requests default
    185  1.34    simonb  */
    186  1.37    simonb #define __USE_TOPDOWN_VM
    187  1.52  christos 
    188  1.52  christos #define VM_DEFAULT_ADDRESS_TOPDOWN(da, sz) \
    189  1.52  christos     trunc_page(USRSTACK - MAXSSIZ - (sz))
    190  1.52  christos #define VM_DEFAULT_ADDRESS_BOTTOMUP(da, sz) \
    191  1.52  christos     round_page((vaddr_t)(da) + (vsize_t)maxdmap)
    192  1.52  christos 
    193  1.52  christos #define VM_DEFAULT_ADDRESS32_TOPDOWN(da, sz) \
    194  1.52  christos     trunc_page(USRSTACK32 - MAXSSIZ32 - (sz))
    195  1.52  christos #define VM_DEFAULT_ADDRESS32_BOTTOMUP(da, sz) \
    196  1.52  christos     round_page((vaddr_t)(da) + (vsize_t)MAXDSIZ32)
    197  1.34    simonb 
    198   1.1   deraadt /* virtual sizes (bytes) for various kernel submaps */
    199  1.32   thorpej #define VM_PHYS_SIZE		(USRIOSIZE*PAGE_SIZE)
    200  1.10   thorpej 
    201  1.10   thorpej /* VM_PHYSSEG_MAX defined by platform-dependent code. */
    202  1.10   thorpej #define	VM_PHYSSEG_STRAT	VM_PSTRAT_BSEARCH
    203  1.48      matt #define	VM_PHYSSEG_NOADD	/* can add RAM after vm_mem_init */
    204  1.27   thorpej 
    205  1.44      matt #ifndef VM_NFREELIST
    206  1.44      matt #define	VM_NFREELIST		16	/* 16 distinct memory segments */
    207  1.44      matt #define VM_FREELIST_DEFAULT	0
    208  1.48      matt #define VM_FREELIST_MAX		1
    209  1.48      matt #endif
    210  1.48      matt 
    211  1.48      matt #ifdef _KERNEL
    212  1.48      matt #define	UVM_KM_VMFREELIST	mips_poolpage_vmfreelist
    213  1.48      matt extern int mips_poolpage_vmfreelist;
    214  1.50      matt #ifdef ENABLE_MIPS_16KB_PAGE
    215  1.50      matt extern vaddr_t mips_vm_maxuser_address;
    216  1.50      matt #endif
    217  1.44      matt #endif
    218  1.44      matt 
    219  1.10   thorpej #endif /* ! _MIPS_VMPARAM_H_ */
    220