1 /*
2  *  arm signal definitions
3  *
4  *  Copyright (c) 2013 Stacey D. Son
5  *
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2 of the License, or
9  *  (at your option) any later version.
10  *
11  *  This program 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
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef TARGET_ARCH_SIGNAL_H
21 #define TARGET_ARCH_SIGNAL_H
22 
23 #include "cpu.h"
24 
25 #define TARGET_REG_R0   0
26 #define TARGET_REG_R1   1
27 #define TARGET_REG_R2   2
28 #define TARGET_REG_R3   3
29 #define TARGET_REG_R4   4
30 #define TARGET_REG_R5   5
31 #define TARGET_REG_R6   6
32 #define TARGET_REG_R7   7
33 #define TARGET_REG_R8   8
34 #define TARGET_REG_R9   9
35 #define TARGET_REG_R10  10
36 #define TARGET_REG_R11  11
37 #define TARGET_REG_R12  12
38 #define TARGET_REG_R13  13
39 #define TARGET_REG_R14  14
40 #define TARGET_REG_R15  15
41 #define TARGET_REG_CPSR 16
42 #define TARGET__NGREG   17
43 /* Convenience synonyms */
44 #define TARGET_REG_FP   TARGET_REG_R11
45 #define TARGET_REG_SP   TARGET_REG_R13
46 #define TARGET_REG_LR   TARGET_REG_R14
47 #define TARGET_REG_PC   TARGET_REG_R15
48 
49 #define TARGET_INSN_SIZE    4       /* arm instruction size */
50 
51 /* Size of the signal trampolin code. See _sigtramp(). */
52 #define TARGET_SZSIGCODE    ((abi_ulong)(9 * TARGET_INSN_SIZE))
53 
54 /* compare to arm/include/_limits.h */
55 #define TARGET_MINSIGSTKSZ  (1024 * 4)                  /* min sig stack size */
56 #define TARGET_SIGSTKSZ     (TARGET_MINSIGSTKSZ + 32768)  /* recommended size */
57 
58 /*
59  * Floating point register state
60  */
61 typedef struct target_mcontext_vfp {
62     abi_ullong  mcv_reg[32];
63     abi_ulong   mcv_fpscr;
64 } target_mcontext_vfp_t;
65 
66 typedef struct target_mcontext {
67     abi_uint    __gregs[TARGET__NGREG];
68 
69     /*
70      * Originally, rest of this structure was named __fpu, 35 * 4 bytes
71      * long, never accessed from kernel.
72      */
73     abi_ulong   mc_vfp_size;
74     abi_ptr     mc_vfp_ptr;
75     abi_int     mc_spare[33];
76 } target_mcontext_t;
77 
78 #define TARGET_MCONTEXT_SIZE 208
79 #define TARGET_UCONTEXT_SIZE 260
80 
81 #include "target_os_ucontext.h"
82 
83 struct target_sigframe {
84     target_siginfo_t    sf_si;  /* saved siginfo */
85     target_ucontext_t   sf_uc;  /* saved ucontext */
86     target_mcontext_vfp_t sf_vfp; /* actual saved VFP context */
87 };
88 
89 #define TARGET_SIGSTACK_ALIGN 8
90 
91 #endif /* TARGET_ARCH_SIGNAL_H */
92