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