1*0a6a1f1dSLionel Sambuc /* $NetBSD: vmparam.h,v 1.39 2015/06/20 07:13:25 skrll Exp $ */ 281473dbbSBen Gras 381473dbbSBen Gras /* 481473dbbSBen Gras * Copyright (c) 2001, 2002 Wasabi Systems, Inc. 581473dbbSBen Gras * All rights reserved. 681473dbbSBen Gras * 781473dbbSBen Gras * Written by Jason R. Thorpe for Wasabi Systems, Inc. 881473dbbSBen Gras * 981473dbbSBen Gras * Redistribution and use in source and binary forms, with or without 1081473dbbSBen Gras * modification, are permitted provided that the following conditions 1181473dbbSBen Gras * are met: 1281473dbbSBen Gras * 1. Redistributions of source code must retain the above copyright 1381473dbbSBen Gras * notice, this list of conditions and the following disclaimer. 1481473dbbSBen Gras * 2. Redistributions in binary form must reproduce the above copyright 1581473dbbSBen Gras * notice, this list of conditions and the following disclaimer in the 1681473dbbSBen Gras * documentation and/or other materials provided with the distribution. 1781473dbbSBen Gras * 3. All advertising materials mentioning features or use of this software 1881473dbbSBen Gras * must display the following acknowledgement: 1981473dbbSBen Gras * This product includes software developed for the NetBSD Project by 2081473dbbSBen Gras * Wasabi Systems, Inc. 2181473dbbSBen Gras * 4. The name of Wasabi Systems, Inc. may not be used to endorse 2281473dbbSBen Gras * or promote products derived from this software without specific prior 2381473dbbSBen Gras * written permission. 2481473dbbSBen Gras * 2581473dbbSBen Gras * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND 2681473dbbSBen Gras * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 2781473dbbSBen Gras * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 2881473dbbSBen Gras * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC 2981473dbbSBen Gras * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 3081473dbbSBen Gras * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 3181473dbbSBen Gras * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 3281473dbbSBen Gras * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 3381473dbbSBen Gras * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 3481473dbbSBen Gras * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 3581473dbbSBen Gras * POSSIBILITY OF SUCH DAMAGE. 3681473dbbSBen Gras */ 3781473dbbSBen Gras 38f6aac1c3SLionel Sambuc #ifndef _ARM_ARM32_VMPARAM_H_ 39f6aac1c3SLionel Sambuc #define _ARM_ARM32_VMPARAM_H_ 40f6aac1c3SLionel Sambuc 4181473dbbSBen Gras #if defined(_KERNEL) || defined(_KMEMUSER) || defined(__minix) 4281473dbbSBen Gras 43f6aac1c3SLionel Sambuc /* 44f6aac1c3SLionel Sambuc * Virtual Memory parameters common to all arm32 platforms. 45f6aac1c3SLionel Sambuc */ 46f6aac1c3SLionel Sambuc 47*0a6a1f1dSLionel Sambuc #include <arm/cpuconf.h> 4881473dbbSBen Gras #include <arm/arm32/pte.h> /* pt_entry_t */ 4981473dbbSBen Gras 50*0a6a1f1dSLionel Sambuc #define __USE_TOPDOWN_VM 5181473dbbSBen Gras #define USRSTACK VM_MAXUSER_ADDRESS 5281473dbbSBen Gras 5381473dbbSBen Gras /* 54*0a6a1f1dSLionel Sambuc * ARMv4 systems are normaly configured for 256MB KVA only, so restrict 55*0a6a1f1dSLionel Sambuc * the size of the pager map to 4MB. 56*0a6a1f1dSLionel Sambuc */ 57*0a6a1f1dSLionel Sambuc #ifndef _ARM_ARCH_5 58*0a6a1f1dSLionel Sambuc #define PAGER_MAP_DEFAULT_SIZE (4 * 1024 * 1024) 59*0a6a1f1dSLionel Sambuc #endif 60*0a6a1f1dSLionel Sambuc 61*0a6a1f1dSLionel Sambuc /* 6281473dbbSBen Gras * Note that MAXTSIZ can't be larger than 32M, otherwise the compiler 6381473dbbSBen Gras * would have to be changed to not generate "bl" instructions. 6481473dbbSBen Gras */ 65*0a6a1f1dSLionel Sambuc #define MAXTSIZ (128*1024*1024) /* max text size */ 6681473dbbSBen Gras #ifndef DFLDSIZ 67*0a6a1f1dSLionel Sambuc #define DFLDSIZ (384*1024*1024) /* initial data size limit */ 6881473dbbSBen Gras #endif 6981473dbbSBen Gras #ifndef MAXDSIZ 70*0a6a1f1dSLionel Sambuc #define MAXDSIZ (1536*1024*1024) /* max data size */ 7181473dbbSBen Gras #endif 7281473dbbSBen Gras #ifndef DFLSSIZ 73*0a6a1f1dSLionel Sambuc #define DFLSSIZ (4*1024*1024) /* initial stack size limit */ 7481473dbbSBen Gras #endif 7581473dbbSBen Gras #ifndef MAXSSIZ 76*0a6a1f1dSLionel Sambuc #define MAXSSIZ (64*1024*1024) /* max stack size */ 7781473dbbSBen Gras #endif 7881473dbbSBen Gras 7981473dbbSBen Gras /* 8081473dbbSBen Gras * While the ARM architecture defines Section mappings, large pages, 8181473dbbSBen Gras * and small pages, the standard page size is (and will always be) 4K. 8281473dbbSBen Gras */ 8384d9c625SLionel Sambuc #define PAGE_SHIFT PGSHIFT 84f6aac1c3SLionel Sambuc #define PAGE_SIZE (1 << PAGE_SHIFT) 85f6aac1c3SLionel Sambuc #define PAGE_MASK (PAGE_SIZE - 1) 86f6aac1c3SLionel Sambuc 8781473dbbSBen Gras /* 8881473dbbSBen Gras * Mach derived constants 8981473dbbSBen Gras */ 90*0a6a1f1dSLionel Sambuc #define VM_MIN_ADDRESS ((vaddr_t) PAGE_SIZE) 91*0a6a1f1dSLionel Sambuc #ifdef ARM_MMU_EXTENDED 92*0a6a1f1dSLionel Sambuc #define VM_MAXUSER_ADDRESS ((vaddr_t) 0x80000000 - PAGE_SIZE) 93*0a6a1f1dSLionel Sambuc #else 94*0a6a1f1dSLionel Sambuc #define VM_MAXUSER_ADDRESS ((vaddr_t) KERNEL_BASE - PAGE_SIZE) 95*0a6a1f1dSLionel Sambuc #endif 9681473dbbSBen Gras #define VM_MAX_ADDRESS VM_MAXUSER_ADDRESS 9781473dbbSBen Gras 9881473dbbSBen Gras #define VM_MIN_KERNEL_ADDRESS ((vaddr_t) KERNEL_BASE) 99*0a6a1f1dSLionel Sambuc #define VM_MAX_KERNEL_ADDRESS ((vaddr_t) -(PAGE_SIZE+1)) 10081473dbbSBen Gras 101*0a6a1f1dSLionel Sambuc #if !defined(__minix) 10281473dbbSBen Gras #ifndef __ASSEMBLER__ 10381473dbbSBen Gras /* XXX max. amount of KVM to be used by buffers. */ 10481473dbbSBen Gras #ifndef VM_MAX_KERNEL_BUF 10581473dbbSBen Gras extern vaddr_t virtual_avail; 10681473dbbSBen Gras extern vaddr_t virtual_end; 10781473dbbSBen Gras 10881473dbbSBen Gras #define VM_MAX_KERNEL_BUF \ 10981473dbbSBen Gras ((virtual_end - virtual_avail) * 4 / 10) 11081473dbbSBen Gras #endif 11181473dbbSBen Gras #endif /* __ASSEMBLER__ */ 112*0a6a1f1dSLionel Sambuc #endif /* !defined(__minix) */ 11381473dbbSBen Gras 11481473dbbSBen Gras #endif /* _KERNEL || _KMEMUSER */ 11581473dbbSBen Gras 116f6aac1c3SLionel Sambuc #endif /* _ARM_ARM32_VMPARAM_H_ */ 117