| 1 | /* |
| 2 | * ARM AArch64 VM parameters definitions for bsd-user. |
| 3 | * |
| 4 | * Copyright (c) 2015 Stacey D. Son |
| 5 | * |
| 6 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 7 | */ |
| 8 | #ifndef TARGET_ARCH_VMPARAM_H |
| 9 | #define TARGET_ARCH_VMPARAM_H |
| 10 | |
| 11 | #include "cpu.h" |
| 12 | |
| 13 | /** |
| 14 | * FreeBSD/arm64 Address space layout. |
| 15 | * |
| 16 | * ARMv8 implements up to a 48 bit virtual address space. The address space is |
| 17 | * split into 2 regions at each end of the 64 bit address space, with an |
| 18 | * out of range "hole" in the middle. |
| 19 | * |
| 20 | * We limit the size of the two spaces to 39 bits each. |
| 21 | * |
| 22 | * Upper region: 0xffffffffffffffff |
| 23 | * 0xffffff8000000000 |
| 24 | * |
| 25 | * Hole: 0xffffff7fffffffff |
| 26 | * 0x0000008000000000 |
| 27 | * |
| 28 | * Lower region: 0x0000007fffffffff |
| 29 | * 0x0000000000000000 |
| 30 | * |
| 31 | * The upper region for the kernel, and the lower region for userland. |
| 32 | */ |
| 33 | |
| 34 | |
| 35 | /* compare to sys/arm64/include/vmparam.h */ |
| 36 | #define TARGET_MAXTSIZ (1 * GiB) /* max text size */ |
| 37 | #define TARGET_DFLDSIZ (128 * MiB) /* initial data size limit */ |
| 38 | #define TARGET_MAXDSIZ (1 * GiB) /* max data size */ |
| 39 | #define TARGET_DFLSSIZ (128 * MiB) /* initial stack size limit */ |
| 40 | #define TARGET_MAXSSIZ (1 * GiB) /* max stack size */ |
| 41 | #define TARGET_SGROWSIZ (128 * KiB) /* amount to grow stack */ |
| 42 | |
| 43 | /* KERNBASE - 512 MB */ |
| 44 | #define TARGET_VM_MAXUSER_ADDRESS (0x00007fffff000000ULL - (512 * MiB)) |
| 45 | #define TARGET_USRSTACK TARGET_VM_MAXUSER_ADDRESS |
| 46 | |
| 47 | static inline abi_ulong get_sp_from_cpustate(CPUARMState *state) |
| 48 | { |
| 49 | return state->xregs[31]; /* sp */ |
| 50 | } |
| 51 | |
| 52 | static inline void set_second_rval(CPUARMState *state, abi_ulong retval2) |
| 53 | { |
| 54 | state->xregs[1] = retval2; /* XXX not really used on 64-bit arch */ |
| 55 | } |
| 56 | |
| 57 | static inline abi_ulong get_second_rval(CPUARMState *state) |
| 58 | { |
| 59 | return state->xregs[1]; |
| 60 | } |
| 61 | |
| 62 | #endif /* TARGET_ARCH_VMPARAM_H */ |