1 /*
2  * ARM AArch64 specific CPU for bsd-user
3  *
4  * Copyright (c) 2015 Stacey D. Son <sson at Freebsd>
5  *
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.
10  *
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.
15  *
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/>.
18  */
19 
20 #ifndef BSD_USER_AARCH64_TARGET_SYSCALL_H
21 #define BSD_USER_AARCH64_TARGET_SYSCALL_H
22 
23 /*
24  * The aarch64 registers are named:
25  *
26  * x0 through x30 - for 64-bit-wide access (same registers)
27  * Register '31' is one of two registers depending on the instruction context:
28  *  For instructions dealing with the stack, it is the stack pointer, named rsp
29  *  For all other instructions, it is a "zero" register, which returns 0 when
30  *  read and discards data when written - named rzr (xzr, wzr)
31  *
32  * Usage during syscall/function call:
33  * r0-r7 are used for arguments and return values
34  * For syscalls, the syscall number is in r8
35  * r9-r15 are for temporary values (may get trampled)
36  * r16-r18 are used for intra-procedure-call and platform values (avoid)
37  * The called routine is expected to preserve r19-r28
38  * r29 and r30 are used as the frame register and link register (avoid)
39  * See the ARM Procedure Call Reference for details.
40  */
41 struct target_pt_regs {
42     uint64_t    regs[31];
43     uint64_t    sp;
44     uint64_t    pc;
45     uint64_t    pstate;
46 };
47 
48 #define TARGET_HW_MACHINE       "arm64"
49 #define TARGET_HW_MACHINE_ARCH  "aarch64"
50 
51 #endif /* BSD_USER_AARCH64_TARGET_SYSCALL_H */
52