Commit | Line | Data |
---|---|---|
d9311bfa AT |
1 | /* Common target dependent code for GNU/Linux on ARM systems. |
2 | ||
3 | Copyright (C) 1999-2015 Free Software Foundation, Inc. | |
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 | ||
20 | #ifndef ARM_LINUX_H | |
21 | #define ARM_LINUX_H | |
22 | ||
23 | /* There are a couple of different possible stack layouts that | |
24 | we need to support. | |
25 | ||
26 | Before version 2.6.18, the kernel used completely independent | |
27 | layouts for non-RT and RT signals. For non-RT signals the stack | |
28 | began directly with a struct sigcontext. For RT signals the stack | |
29 | began with two redundant pointers (to the siginfo and ucontext), | |
30 | and then the siginfo and ucontext. | |
31 | ||
32 | As of version 2.6.18, the non-RT signal frame layout starts with | |
33 | a ucontext and the RT signal frame starts with a siginfo and then | |
34 | a ucontext. Also, the ucontext now has a designated save area | |
35 | for coprocessor registers. | |
36 | ||
37 | For RT signals, it's easy to tell the difference: we look for | |
38 | pinfo, the pointer to the siginfo. If it has the expected | |
39 | value, we have an old layout. If it doesn't, we have the new | |
40 | layout. | |
41 | ||
42 | For non-RT signals, it's a bit harder. We need something in one | |
43 | layout or the other with a recognizable offset and value. We can't | |
44 | use the return trampoline, because ARM usually uses SA_RESTORER, | |
45 | in which case the stack return trampoline is not filled in. | |
46 | We can't use the saved stack pointer, because sigaltstack might | |
47 | be in use. So for now we guess the new layout... */ | |
48 | ||
49 | /* There are three words (trap_no, error_code, oldmask) in | |
50 | struct sigcontext before r0. */ | |
51 | #define ARM_SIGCONTEXT_R0 0xc | |
52 | ||
53 | /* There are five words (uc_flags, uc_link, and three for uc_stack) | |
54 | in the ucontext_t before the sigcontext. */ | |
55 | #define ARM_UCONTEXT_SIGCONTEXT 0x14 | |
56 | ||
57 | /* There are three elements in an rt_sigframe before the ucontext: | |
58 | pinfo, puc, and info. The first two are pointers and the third | |
59 | is a struct siginfo, with size 128 bytes. We could follow puc | |
60 | to the ucontext, but it's simpler to skip the whole thing. */ | |
61 | #define ARM_OLD_RT_SIGFRAME_SIGINFO 0x8 | |
62 | #define ARM_OLD_RT_SIGFRAME_UCONTEXT 0x88 | |
63 | ||
64 | #define ARM_NEW_RT_SIGFRAME_UCONTEXT 0x80 | |
65 | ||
66 | #define ARM_NEW_SIGFRAME_MAGIC 0x5ac3c35a | |
67 | ||
68 | int | |
69 | arm_linux_sigreturn_next_pc_offset (unsigned long sp, | |
70 | unsigned long sp_data, | |
71 | unsigned long svc_number, | |
72 | int is_sigreturn); | |
73 | ||
74 | #endif /* ARM_LINUX_H */ |