1*8cbb4fc1SStacey Son /*
2*8cbb4fc1SStacey Son  * ARM AArch64 specific CPU for bsd-user
3*8cbb4fc1SStacey Son  *
4*8cbb4fc1SStacey Son  * Copyright (c) 2015 Stacey D. Son <sson at Freebsd>
5*8cbb4fc1SStacey Son  *
6*8cbb4fc1SStacey Son  * This library is free software; you can redistribute it and/or
7*8cbb4fc1SStacey Son  * modify it under the terms of the GNU Lesser General Public
8*8cbb4fc1SStacey Son  * License as published by the Free Software Foundation; either
9*8cbb4fc1SStacey Son  * version 2 of the License, or (at your option) any later version.
10*8cbb4fc1SStacey Son  *
11*8cbb4fc1SStacey Son  * This library is distributed in the hope that it will be useful,
12*8cbb4fc1SStacey Son  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13*8cbb4fc1SStacey Son  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14*8cbb4fc1SStacey Son  * Lesser General Public License for more details.
15*8cbb4fc1SStacey Son  *
16*8cbb4fc1SStacey Son  * You should have received a copy of the GNU Lesser General Public
17*8cbb4fc1SStacey Son  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
18*8cbb4fc1SStacey Son  */
19*8cbb4fc1SStacey Son 
20*8cbb4fc1SStacey Son #ifndef BSD_USER_AARCH64_TARGET_SYSCALL_H
21*8cbb4fc1SStacey Son #define BSD_USER_AARCH64_TARGET_SYSCALL_H
22*8cbb4fc1SStacey Son 
23*8cbb4fc1SStacey Son /*
24*8cbb4fc1SStacey Son  * The aarch64 registers are named:
25*8cbb4fc1SStacey Son  *
26*8cbb4fc1SStacey Son  * x0 through x30 - for 64-bit-wide access (same registers)
27*8cbb4fc1SStacey Son  * Register '31' is one of two registers depending on the instruction context:
28*8cbb4fc1SStacey Son  *  For instructions dealing with the stack, it is the stack pointer, named rsp
29*8cbb4fc1SStacey Son  *  For all other instructions, it is a "zero" register, which returns 0 when
30*8cbb4fc1SStacey Son  *  read and discards data when written - named rzr (xzr, wzr)
31*8cbb4fc1SStacey Son  *
32*8cbb4fc1SStacey Son  * Usage during syscall/function call:
33*8cbb4fc1SStacey Son  * r0-r7 are used for arguments and return values
34*8cbb4fc1SStacey Son  * For syscalls, the syscall number is in r8
35*8cbb4fc1SStacey Son  * r9-r15 are for temporary values (may get trampled)
36*8cbb4fc1SStacey Son  * r16-r18 are used for intra-procedure-call and platform values (avoid)
37*8cbb4fc1SStacey Son  * The called routine is expected to preserve r19-r28
38*8cbb4fc1SStacey Son  * r29 and r30 are used as the frame register and link register (avoid)
39*8cbb4fc1SStacey Son  * See the ARM Procedure Call Reference for details.
40*8cbb4fc1SStacey Son  */
41*8cbb4fc1SStacey Son struct target_pt_regs {
42*8cbb4fc1SStacey Son     uint64_t    regs[31];
43*8cbb4fc1SStacey Son     uint64_t    sp;
44*8cbb4fc1SStacey Son     uint64_t    pc;
45*8cbb4fc1SStacey Son     uint64_t    pstate;
46*8cbb4fc1SStacey Son };
47*8cbb4fc1SStacey Son 
48*8cbb4fc1SStacey Son #define TARGET_HW_MACHINE       "arm64"
49*8cbb4fc1SStacey Son #define TARGET_HW_MACHINE_ARCH  "aarch64"
50*8cbb4fc1SStacey Son 
51*8cbb4fc1SStacey Son #endif /* BSD_USER_AARCH64_TARGET_SYSCALL_H */
52