11acce771SStacey Son /* 21acce771SStacey Son * ARM AArch64 VM parameters definitions for bsd-user. 31acce771SStacey Son * 41acce771SStacey Son * Copyright (c) 2015 Stacey D. Son <sson at FreeBSD> 51acce771SStacey Son * 61acce771SStacey Son * This library is free software; you can redistribute it and/or 71acce771SStacey Son * modify it under the terms of the GNU Lesser General Public 81acce771SStacey Son * License as published by the Free Software Foundation; either 91acce771SStacey Son * version 2 of the License, or (at your option) any later version. 101acce771SStacey Son * 111acce771SStacey Son * This library is distributed in the hope that it will be useful, 121acce771SStacey Son * but WITHOUT ANY WARRANTY; without even the implied warranty of 131acce771SStacey Son * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 141acce771SStacey Son * Lesser General Public License for more details. 151acce771SStacey Son * 161acce771SStacey Son * You should have received a copy of the GNU Lesser General Public 171acce771SStacey Son * License along with this library; if not, see <http://www.gnu.org/licenses/>. 181acce771SStacey Son */ 191acce771SStacey Son 201acce771SStacey Son #ifndef TARGET_ARCH_VMPARAM_H 211acce771SStacey Son #define TARGET_ARCH_VMPARAM_H 221acce771SStacey Son 231acce771SStacey Son #include "cpu.h" 241acce771SStacey Son 251acce771SStacey Son /** 261acce771SStacey Son * FreeBSD/arm64 Address space layout. 271acce771SStacey Son * 281acce771SStacey Son * ARMv8 implements up to a 48 bit virtual address space. The address space is 291acce771SStacey Son * split into 2 regions at each end of the 64 bit address space, with an 301acce771SStacey Son * out of range "hole" in the middle. 311acce771SStacey Son * 321acce771SStacey Son * We limit the size of the two spaces to 39 bits each. 331acce771SStacey Son * 341acce771SStacey Son * Upper region: 0xffffffffffffffff 351acce771SStacey Son * 0xffffff8000000000 361acce771SStacey Son * 371acce771SStacey Son * Hole: 0xffffff7fffffffff 381acce771SStacey Son * 0x0000008000000000 391acce771SStacey Son * 401acce771SStacey Son * Lower region: 0x0000007fffffffff 411acce771SStacey Son * 0x0000000000000000 421acce771SStacey Son * 431acce771SStacey Son * The upper region for the kernel, and the lower region for userland. 441acce771SStacey Son */ 451acce771SStacey Son 461acce771SStacey Son 471acce771SStacey Son /* compare to sys/arm64/include/vmparam.h */ 481acce771SStacey Son #define TARGET_MAXTSIZ (1 * GiB) /* max text size */ 491acce771SStacey Son #define TARGET_DFLDSIZ (128 * MiB) /* initial data size limit */ 501acce771SStacey Son #define TARGET_MAXDSIZ (1 * GiB) /* max data size */ 511acce771SStacey Son #define TARGET_DFLSSIZ (128 * MiB) /* initial stack size limit */ 521acce771SStacey Son #define TARGET_MAXSSIZ (1 * GiB) /* max stack size */ 531acce771SStacey Son #define TARGET_SGROWSIZ (128 * KiB) /* amount to grow stack */ 541acce771SStacey Son 551acce771SStacey Son /* KERNBASE - 512 MB */ 561acce771SStacey Son #define TARGET_VM_MAXUSER_ADDRESS (0x00007fffff000000ULL - (512 * MiB)) 571acce771SStacey Son #define TARGET_USRSTACK TARGET_VM_MAXUSER_ADDRESS 581acce771SStacey Son get_sp_from_cpustate(CPUARMState * state)591acce771SStacey Sonstatic inline abi_ulong get_sp_from_cpustate(CPUARMState *state) 601acce771SStacey Son { 611acce771SStacey Son return state->xregs[31]; /* sp */ 621acce771SStacey Son } 631acce771SStacey Son set_second_rval(CPUARMState * state,abi_ulong retval2)641acce771SStacey Sonstatic inline void set_second_rval(CPUARMState *state, abi_ulong retval2) 651acce771SStacey Son { 661acce771SStacey Son state->xregs[1] = retval2; /* XXX not really used on 64-bit arch */ 671acce771SStacey Son } 68*1541d87dSWarner Losh get_second_rval(CPUARMState * state)69*1541d87dSWarner Loshstatic inline abi_ulong get_second_rval(CPUARMState *state) 70*1541d87dSWarner Losh { 71*1541d87dSWarner Losh return state->xregs[1]; 72*1541d87dSWarner Losh } 73*1541d87dSWarner Losh 741acce771SStacey Son #endif /* TARGET_ARCH_VMPARAM_H */ 75