1*1acce771SStacey Son /* 2*1acce771SStacey Son * ARM AArch64 VM parameters definitions for bsd-user. 3*1acce771SStacey Son * 4*1acce771SStacey Son * Copyright (c) 2015 Stacey D. Son <sson at FreeBSD> 5*1acce771SStacey Son * 6*1acce771SStacey Son * This library is free software; you can redistribute it and/or 7*1acce771SStacey Son * modify it under the terms of the GNU Lesser General Public 8*1acce771SStacey Son * License as published by the Free Software Foundation; either 9*1acce771SStacey Son * version 2 of the License, or (at your option) any later version. 10*1acce771SStacey Son * 11*1acce771SStacey Son * This library is distributed in the hope that it will be useful, 12*1acce771SStacey Son * but WITHOUT ANY WARRANTY; without even the implied warranty of 13*1acce771SStacey Son * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14*1acce771SStacey Son * Lesser General Public License for more details. 15*1acce771SStacey Son * 16*1acce771SStacey Son * You should have received a copy of the GNU Lesser General Public 17*1acce771SStacey Son * License along with this library; if not, see <http://www.gnu.org/licenses/>. 18*1acce771SStacey Son */ 19*1acce771SStacey Son 20*1acce771SStacey Son #ifndef TARGET_ARCH_VMPARAM_H 21*1acce771SStacey Son #define TARGET_ARCH_VMPARAM_H 22*1acce771SStacey Son 23*1acce771SStacey Son #include "cpu.h" 24*1acce771SStacey Son 25*1acce771SStacey Son /** 26*1acce771SStacey Son * FreeBSD/arm64 Address space layout. 27*1acce771SStacey Son * 28*1acce771SStacey Son * ARMv8 implements up to a 48 bit virtual address space. The address space is 29*1acce771SStacey Son * split into 2 regions at each end of the 64 bit address space, with an 30*1acce771SStacey Son * out of range "hole" in the middle. 31*1acce771SStacey Son * 32*1acce771SStacey Son * We limit the size of the two spaces to 39 bits each. 33*1acce771SStacey Son * 34*1acce771SStacey Son * Upper region: 0xffffffffffffffff 35*1acce771SStacey Son * 0xffffff8000000000 36*1acce771SStacey Son * 37*1acce771SStacey Son * Hole: 0xffffff7fffffffff 38*1acce771SStacey Son * 0x0000008000000000 39*1acce771SStacey Son * 40*1acce771SStacey Son * Lower region: 0x0000007fffffffff 41*1acce771SStacey Son * 0x0000000000000000 42*1acce771SStacey Son * 43*1acce771SStacey Son * The upper region for the kernel, and the lower region for userland. 44*1acce771SStacey Son */ 45*1acce771SStacey Son 46*1acce771SStacey Son 47*1acce771SStacey Son /* compare to sys/arm64/include/vmparam.h */ 48*1acce771SStacey Son #define TARGET_MAXTSIZ (1 * GiB) /* max text size */ 49*1acce771SStacey Son #define TARGET_DFLDSIZ (128 * MiB) /* initial data size limit */ 50*1acce771SStacey Son #define TARGET_MAXDSIZ (1 * GiB) /* max data size */ 51*1acce771SStacey Son #define TARGET_DFLSSIZ (128 * MiB) /* initial stack size limit */ 52*1acce771SStacey Son #define TARGET_MAXSSIZ (1 * GiB) /* max stack size */ 53*1acce771SStacey Son #define TARGET_SGROWSIZ (128 * KiB) /* amount to grow stack */ 54*1acce771SStacey Son 55*1acce771SStacey Son /* KERNBASE - 512 MB */ 56*1acce771SStacey Son #define TARGET_VM_MAXUSER_ADDRESS (0x00007fffff000000ULL - (512 * MiB)) 57*1acce771SStacey Son #define TARGET_USRSTACK TARGET_VM_MAXUSER_ADDRESS 58*1acce771SStacey Son 59*1acce771SStacey Son static inline abi_ulong get_sp_from_cpustate(CPUARMState *state) 60*1acce771SStacey Son { 61*1acce771SStacey Son return state->xregs[31]; /* sp */ 62*1acce771SStacey Son } 63*1acce771SStacey Son 64*1acce771SStacey Son static inline void set_second_rval(CPUARMState *state, abi_ulong retval2) 65*1acce771SStacey Son { 66*1acce771SStacey Son state->xregs[1] = retval2; /* XXX not really used on 64-bit arch */ 67*1acce771SStacey Son } 68*1acce771SStacey Son #endif /* TARGET_ARCH_VMPARAM_H */ 69