disable sstrip when using musl
[lede.git] / target / linux / ubicom32 / files / arch / ubicom32 / include / asm / ptrace.h
1 /*
2  * arch/ubicom32/include/asm/ptrace.h
3  *   Ubicom32 architecture ptrace support.
4  *
5  * (C) Copyright 2009, Ubicom, Inc.
6  *
7  * This file is part of the Ubicom32 Linux Kernel Port.
8  *
9  * The Ubicom32 Linux Kernel Port is free software: you can redistribute
10  * it and/or modify it under the terms of the GNU General Public License
11  * as published by the Free Software Foundation, either version 2 of the
12  * License, or (at your option) any later version.
13  *
14  * The Ubicom32 Linux Kernel Port is distributed in the hope that it
15  * will be useful, but WITHOUT ANY WARRANTY; without even the implied
16  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
17  * the GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with the Ubicom32 Linux Kernel Port.  If not,
21  * see <http://www.gnu.org/licenses/>.
22  *
23  * Ubicom32 implementation derived from (with many thanks):
24  *   arch/m68knommu
25  *   arch/blackfin
26  *   arch/parisc
27  */
28 #ifndef _ASM_UBICOM32_PTRACE_H
29 #define _ASM_UBICOM32_PTRACE_H
30
31 #ifndef __ASSEMBLY__
32
33 /*
34  * We use hard coded constants because this is shared with user
35  * space and the values are NOT allowed to change.  Only fields
36  * that are intended to be exposed get values.
37  */
38 #define PT_D0           0
39 #define PT_D1           4
40 #define PT_D2           8
41 #define PT_D3           12
42 #define PT_D4           16
43 #define PT_D5           20
44 #define PT_D6           24
45 #define PT_D7           28
46 #define PT_D8           32
47 #define PT_D9           36
48 #define PT_D10          40
49 #define PT_D11          44
50 #define PT_D12          48
51 #define PT_D13          52
52 #define PT_D14          56
53 #define PT_D15          60
54 #define PT_A0           64
55 #define PT_A1           68
56 #define PT_A2           72
57 #define PT_A3           76
58 #define PT_A4           80
59 #define PT_A5           84
60 #define PT_A6           88
61 #define PT_A7           92
62 #define PT_SP           92
63 #define PT_ACC0HI       96
64 #define PT_ACC0LO       100
65 #define PT_MAC_RC16     104
66 #define PT_ACC1HI       108
67 #define PT_ACC1LO       112
68 #define PT_SOURCE3      116
69 #define PT_INST_CNT     120
70 #define PT_CSR          124
71 #define PT_DUMMY_UNUSED 128
72 #define PT_INT_MASK0    132
73 #define PT_INT_MASK1    136
74 #define PT_TRAP_CAUSE   140
75 #define PT_PC           144
76 #define PT_ORIGINAL_D0  148
77 #define PT_FRAME_TYPE   152
78
79 /*
80  * The following 'registers' are not registers at all but are used
81  * locate the relocated sections.
82  */
83 #define PT_TEXT_ADDR            200
84 #define PT_TEXT_END_ADDR        204
85 #define PT_DATA_ADDR            208
86 #define PT_EXEC_FDPIC_LOADMAP   212
87 #define PT_INTERP_FDPIC_LOADMAP 216
88
89 /*
90  * This struct defines the way the registers are stored on the
91  * stack during a system call.
92  */
93 enum thread_type {
94         NORMAL_THREAD,
95         KERNEL_THREAD,
96 };
97
98 #define UBICOM32_FRAME_TYPE_SYSCALL     -1 /* System call frame */
99 #define UBICOM32_FRAME_TYPE_INVALID     0 /* Invalid frame, no longer in use */
100 #define UBICOM32_FRAME_TYPE_INTERRUPT   1 /* Interrupt frame */
101 #define UBICOM32_FRAME_TYPE_TRAP        2 /* Trap frame */
102 #define UBICOM32_FRAME_TYPE_SIGTRAMP    3 /* Signal trampoline frame. */
103 #define UBICOM32_FRAME_TYPE_NEW_THREAD  4 /* New Thread. */
104
105 struct pt_regs {
106         /*
107          * Data Registers
108          */
109         unsigned long dn[16];
110
111         /*
112          * Address Registers
113          */
114         unsigned long an[8];
115
116         /*
117          * Per thread misc registers.
118          */
119         unsigned long acc0[2];
120         unsigned long mac_rc16;
121         unsigned long acc1[2];
122         unsigned long source3;
123         unsigned long inst_cnt;
124         unsigned long csr;
125         unsigned long dummy_unused;
126         unsigned long int_mask0;
127         unsigned long int_mask1;
128         unsigned long trap_cause;
129         unsigned long pc;
130         unsigned long original_dn_0;
131
132         /*
133          * Frame type. Syscall frames are -1. For other types look above.
134          */
135         unsigned long frame_type;
136
137         /*
138          * These fields are not exposed to ptrace.
139          */
140         unsigned long previous_pc;
141         long nesting_level;             /* When the kernel in in user space this
142                                          * will be -1. */
143         unsigned long thread_type;      /* This indicates if this is a kernel
144                                          * thread. */
145 };
146
147 /*
148  * This is the extended stack used by signal handlers and the context
149  * switcher: it's pushed after the normal "struct pt_regs".
150  */
151 struct switch_stack {
152         unsigned long  dummy;
153 };
154
155 #ifdef __KERNEL__
156
157 /* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
158 #define PTRACE_GETREGS          12
159 #define PTRACE_SETREGS          13
160
161 #ifndef PS_S
162 #define PS_S  (0x2000)
163 #define PS_M  (0x1000)
164 #endif
165
166 extern  int __user_mode(unsigned long sp);
167
168 #define user_mode(regs) (__user_mode((regs->an[7])))
169 #define user_stack(regs) ((regs)->an[7])
170 #define instruction_pointer(regs) ((regs)->pc)
171 #define profile_pc(regs) instruction_pointer(regs)
172 extern void show_regs(struct pt_regs *);
173 #endif /* __KERNEL__ */
174
175 #endif /* __ASSEMBLY__ */
176
177 #endif /* _ASM_UBICOM32_PTRACE_H */