xref: /qemu/bsd-user/aarch64/target_arch_signal.h (revision 7dba5e10a65be276267f379f07a9643100209c0d)
1*7dba5e10SStacey Son /*
2*7dba5e10SStacey Son  * ARM AArch64 specific signal definitions for bsd-user
3*7dba5e10SStacey Son  *
4*7dba5e10SStacey Son  * Copyright (c) 2015 Stacey D. Son <sson at FreeBSD>
5*7dba5e10SStacey Son  *
6*7dba5e10SStacey Son  * This library is free software; you can redistribute it and/or
7*7dba5e10SStacey Son  * modify it under the terms of the GNU Lesser General Public
8*7dba5e10SStacey Son  * License as published by the Free Software Foundation; either
9*7dba5e10SStacey Son  * version 2 of the License, or (at your option) any later version.
10*7dba5e10SStacey Son  *
11*7dba5e10SStacey Son  * This library is distributed in the hope that it will be useful,
12*7dba5e10SStacey Son  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13*7dba5e10SStacey Son  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14*7dba5e10SStacey Son  * Lesser General Public License for more details.
15*7dba5e10SStacey Son  *
16*7dba5e10SStacey Son  * You should have received a copy of the GNU Lesser General Public
17*7dba5e10SStacey Son  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
18*7dba5e10SStacey Son  */
19*7dba5e10SStacey Son 
20*7dba5e10SStacey Son #ifndef TARGET_ARCH_SIGNAL_H
21*7dba5e10SStacey Son #define TARGET_ARCH_SIGNAL_H
22*7dba5e10SStacey Son 
23*7dba5e10SStacey Son #include "cpu.h"
24*7dba5e10SStacey Son 
25*7dba5e10SStacey Son #define TARGET_REG_X0   0
26*7dba5e10SStacey Son #define TARGET_REG_X30  30
27*7dba5e10SStacey Son #define TARGET_REG_X31  31
28*7dba5e10SStacey Son #define TARGET_REG_LR   TARGET_REG_X30
29*7dba5e10SStacey Son #define TARGET_REG_SP   TARGET_REG_X31
30*7dba5e10SStacey Son 
31*7dba5e10SStacey Son #define TARGET_INSN_SIZE    4       /* arm64 instruction size */
32*7dba5e10SStacey Son 
33*7dba5e10SStacey Son /* Size of the signal trampolin code. See _sigtramp(). */
34*7dba5e10SStacey Son #define TARGET_SZSIGCODE    ((abi_ulong)(9 * TARGET_INSN_SIZE))
35*7dba5e10SStacey Son 
36*7dba5e10SStacey Son /* compare to sys/arm64/include/_limits.h */
37*7dba5e10SStacey Son #define TARGET_MINSIGSTKSZ  (1024 * 4)                  /* min sig stack size */
38*7dba5e10SStacey Son #define TARGET_SIGSTKSZ     (TARGET_MINSIGSTKSZ + 32768)  /* recommended size */
39*7dba5e10SStacey Son 
40*7dba5e10SStacey Son /* struct __mcontext in sys/arm64/include/ucontext.h */
41*7dba5e10SStacey Son 
42*7dba5e10SStacey Son struct target_gpregs {
43*7dba5e10SStacey Son     uint64_t    gp_x[30];
44*7dba5e10SStacey Son     uint64_t    gp_lr;
45*7dba5e10SStacey Son     uint64_t    gp_sp;
46*7dba5e10SStacey Son     uint64_t    gp_elr;
47*7dba5e10SStacey Son     uint32_t    gp_spsr;
48*7dba5e10SStacey Son     uint32_t    gp_pad;
49*7dba5e10SStacey Son };
50*7dba5e10SStacey Son 
51*7dba5e10SStacey Son struct target_fpregs {
52*7dba5e10SStacey Son     __uint128_t fp_q[32];
53*7dba5e10SStacey Son     uint32_t    fp_sr;
54*7dba5e10SStacey Son     uint32_t    fp_cr;
55*7dba5e10SStacey Son     uint32_t    fp_flags;
56*7dba5e10SStacey Son     uint32_t    fp_pad;
57*7dba5e10SStacey Son };
58*7dba5e10SStacey Son 
59*7dba5e10SStacey Son struct target__mcontext {
60*7dba5e10SStacey Son     struct target_gpregs mc_gpregs;
61*7dba5e10SStacey Son     struct target_fpregs mc_fpregs;
62*7dba5e10SStacey Son     uint32_t    mc_flags;
63*7dba5e10SStacey Son #define TARGET_MC_FP_VALID  0x1
64*7dba5e10SStacey Son     uint32_t    mc_pad;
65*7dba5e10SStacey Son     uint64_t    mc_spare[8];
66*7dba5e10SStacey Son };
67*7dba5e10SStacey Son 
68*7dba5e10SStacey Son typedef struct target__mcontext target_mcontext_t;
69*7dba5e10SStacey Son 
70*7dba5e10SStacey Son #define TARGET_MCONTEXT_SIZE 880
71*7dba5e10SStacey Son #define TARGET_UCONTEXT_SIZE 960
72*7dba5e10SStacey Son 
73*7dba5e10SStacey Son #include "target_os_ucontext.h"
74*7dba5e10SStacey Son 
75*7dba5e10SStacey Son struct target_sigframe {
76*7dba5e10SStacey Son     target_siginfo_t    sf_si;  /* saved siginfo */
77*7dba5e10SStacey Son     target_ucontext_t   sf_uc;  /* saved ucontext */
78*7dba5e10SStacey Son };
79*7dba5e10SStacey Son 
80*7dba5e10SStacey Son #endif /* TARGET_ARCH_SIGNAL_H */
81