Commit | Line | Data |
---|---|---|
d9311bfa AT |
1 | /* Common target dependent code for GNU/Linux on ARM systems. |
2 | ||
b811d2c2 | 3 | Copyright (C) 1999-2020 Free Software Foundation, Inc. |
d9311bfa AT |
4 | |
5 | This file is part of GDB. | |
6 | ||
7 | This program is free software; you can redistribute it and/or modify | |
8 | it under the terms of the GNU General Public License as published by | |
9 | the Free Software Foundation; either version 3 of the License, or | |
10 | (at your option) any later version. | |
11 | ||
12 | This program is distributed in the hope that it will be useful, | |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | |
19 | ||
1a5c2598 TT |
20 | #ifndef ARCH_ARM_LINUX_H |
21 | #define ARCH_ARM_LINUX_H | |
d9311bfa | 22 | |
6885166d YQ |
23 | /* The index to access CSPR in user_regs defined in GLIBC. */ |
24 | #define ARM_CPSR_GREGNUM 16 | |
25 | ||
d9311bfa AT |
26 | /* There are a couple of different possible stack layouts that |
27 | we need to support. | |
28 | ||
29 | Before version 2.6.18, the kernel used completely independent | |
30 | layouts for non-RT and RT signals. For non-RT signals the stack | |
31 | began directly with a struct sigcontext. For RT signals the stack | |
32 | began with two redundant pointers (to the siginfo and ucontext), | |
33 | and then the siginfo and ucontext. | |
34 | ||
35 | As of version 2.6.18, the non-RT signal frame layout starts with | |
36 | a ucontext and the RT signal frame starts with a siginfo and then | |
37 | a ucontext. Also, the ucontext now has a designated save area | |
38 | for coprocessor registers. | |
39 | ||
40 | For RT signals, it's easy to tell the difference: we look for | |
41 | pinfo, the pointer to the siginfo. If it has the expected | |
42 | value, we have an old layout. If it doesn't, we have the new | |
43 | layout. | |
44 | ||
45 | For non-RT signals, it's a bit harder. We need something in one | |
46 | layout or the other with a recognizable offset and value. We can't | |
47 | use the return trampoline, because ARM usually uses SA_RESTORER, | |
48 | in which case the stack return trampoline is not filled in. | |
49 | We can't use the saved stack pointer, because sigaltstack might | |
50 | be in use. So for now we guess the new layout... */ | |
51 | ||
52 | /* There are three words (trap_no, error_code, oldmask) in | |
53 | struct sigcontext before r0. */ | |
54 | #define ARM_SIGCONTEXT_R0 0xc | |
55 | ||
56 | /* There are five words (uc_flags, uc_link, and three for uc_stack) | |
57 | in the ucontext_t before the sigcontext. */ | |
58 | #define ARM_UCONTEXT_SIGCONTEXT 0x14 | |
59 | ||
60 | /* There are three elements in an rt_sigframe before the ucontext: | |
61 | pinfo, puc, and info. The first two are pointers and the third | |
62 | is a struct siginfo, with size 128 bytes. We could follow puc | |
63 | to the ucontext, but it's simpler to skip the whole thing. */ | |
64 | #define ARM_OLD_RT_SIGFRAME_SIGINFO 0x8 | |
65 | #define ARM_OLD_RT_SIGFRAME_UCONTEXT 0x88 | |
66 | ||
67 | #define ARM_NEW_RT_SIGFRAME_UCONTEXT 0x80 | |
68 | ||
69 | #define ARM_NEW_SIGFRAME_MAGIC 0x5ac3c35a | |
70 | ||
71 | int | |
72 | arm_linux_sigreturn_next_pc_offset (unsigned long sp, | |
73 | unsigned long sp_data, | |
74 | unsigned long svc_number, | |
75 | int is_sigreturn); | |
76 | ||
ed443b61 YQ |
77 | struct arm_get_next_pcs; |
78 | ||
79 | CORE_ADDR arm_linux_get_next_pcs_fixup (struct arm_get_next_pcs *self, | |
80 | CORE_ADDR pc); | |
1a5c2598 TT |
81 | |
82 | #endif /* ARCH_ARM_LINUX_H */ |