]>
Commit | Line | Data |
---|---|---|
9abe5450 | 1 | /* PPC GNU/Linux native support. |
2555fe1a | 2 | |
6aba47ca | 3 | Copyright (C) 1988, 1989, 1991, 1992, 1994, 1996, 2000, 2001, 2002, 2003, |
9b254dd1 | 4 | 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. |
c877c8e6 KB |
5 | |
6 | This file is part of GDB. | |
7 | ||
8 | This program is free software; you can redistribute it and/or modify | |
9 | it under the terms of the GNU General Public License as published by | |
a9762ec7 | 10 | the Free Software Foundation; either version 3 of the License, or |
c877c8e6 KB |
11 | (at your option) any later version. |
12 | ||
13 | This program is distributed in the hope that it will be useful, | |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | GNU General Public License for more details. | |
17 | ||
18 | You should have received a copy of the GNU General Public License | |
a9762ec7 | 19 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
c877c8e6 KB |
20 | |
21 | #include "defs.h" | |
e162d11b | 22 | #include "gdb_string.h" |
c877c8e6 KB |
23 | #include "frame.h" |
24 | #include "inferior.h" | |
25 | #include "gdbcore.h" | |
4e052eda | 26 | #include "regcache.h" |
383f0f5b | 27 | #include "gdb_assert.h" |
10d6c8cd DJ |
28 | #include "target.h" |
29 | #include "linux-nat.h" | |
c877c8e6 | 30 | |
411cb3f9 | 31 | #include <stdint.h> |
c877c8e6 KB |
32 | #include <sys/types.h> |
33 | #include <sys/param.h> | |
34 | #include <signal.h> | |
35 | #include <sys/user.h> | |
36 | #include <sys/ioctl.h> | |
2555fe1a | 37 | #include "gdb_wait.h" |
c877c8e6 KB |
38 | #include <fcntl.h> |
39 | #include <sys/procfs.h> | |
45229ea4 | 40 | #include <sys/ptrace.h> |
c877c8e6 | 41 | |
c60c0f5f MS |
42 | /* Prototypes for supply_gregset etc. */ |
43 | #include "gregset.h" | |
16333c4f | 44 | #include "ppc-tdep.h" |
7284e1be UW |
45 | #include "ppc-linux-tdep.h" |
46 | ||
b7622095 LM |
47 | /* Required when using the AUXV. */ |
48 | #include "elf/common.h" | |
49 | #include "auxv.h" | |
50 | ||
7284e1be UW |
51 | /* This sometimes isn't defined. */ |
52 | #ifndef PT_ORIG_R3 | |
53 | #define PT_ORIG_R3 34 | |
54 | #endif | |
55 | #ifndef PT_TRAP | |
56 | #define PT_TRAP 40 | |
57 | #endif | |
c60c0f5f | 58 | |
b7622095 LM |
59 | #ifndef PPC_FEATURE_BOOKE |
60 | #define PPC_FEATURE_BOOKE 0x00008000 | |
61 | #endif | |
62 | ||
9abe5450 EZ |
63 | /* Glibc's headers don't define PTRACE_GETVRREGS so we cannot use a |
64 | configure time check. Some older glibc's (for instance 2.2.1) | |
65 | don't have a specific powerpc version of ptrace.h, and fall back on | |
66 | a generic one. In such cases, sys/ptrace.h defines | |
67 | PTRACE_GETFPXREGS and PTRACE_SETFPXREGS to the same numbers that | |
68 | ppc kernel's asm/ptrace.h defines PTRACE_GETVRREGS and | |
69 | PTRACE_SETVRREGS to be. This also makes a configury check pretty | |
70 | much useless. */ | |
71 | ||
72 | /* These definitions should really come from the glibc header files, | |
73 | but Glibc doesn't know about the vrregs yet. */ | |
74 | #ifndef PTRACE_GETVRREGS | |
75 | #define PTRACE_GETVRREGS 18 | |
76 | #define PTRACE_SETVRREGS 19 | |
77 | #endif | |
78 | ||
604c2f83 LM |
79 | /* PTRACE requests for POWER7 VSX registers. */ |
80 | #ifndef PTRACE_GETVSXREGS | |
81 | #define PTRACE_GETVSXREGS 27 | |
82 | #define PTRACE_SETVSXREGS 28 | |
83 | #endif | |
01904826 JB |
84 | |
85 | /* Similarly for the ptrace requests for getting / setting the SPE | |
86 | registers (ev0 -- ev31, acc, and spefscr). See the description of | |
87 | gdb_evrregset_t for details. */ | |
88 | #ifndef PTRACE_GETEVRREGS | |
89 | #define PTRACE_GETEVRREGS 20 | |
90 | #define PTRACE_SETEVRREGS 21 | |
91 | #endif | |
92 | ||
e0d24f8d WZ |
93 | /* Similarly for the hardware watchpoint support. */ |
94 | #ifndef PTRACE_GET_DEBUGREG | |
95 | #define PTRACE_GET_DEBUGREG 25 | |
96 | #endif | |
97 | #ifndef PTRACE_SET_DEBUGREG | |
98 | #define PTRACE_SET_DEBUGREG 26 | |
99 | #endif | |
100 | #ifndef PTRACE_GETSIGINFO | |
101 | #define PTRACE_GETSIGINFO 0x4202 | |
102 | #endif | |
01904826 | 103 | |
9abe5450 EZ |
104 | /* This oddity is because the Linux kernel defines elf_vrregset_t as |
105 | an array of 33 16 bytes long elements. I.e. it leaves out vrsave. | |
106 | However the PTRACE_GETVRREGS and PTRACE_SETVRREGS requests return | |
107 | the vrsave as an extra 4 bytes at the end. I opted for creating a | |
108 | flat array of chars, so that it is easier to manipulate for gdb. | |
109 | ||
110 | There are 32 vector registers 16 bytes longs, plus a VSCR register | |
111 | which is only 4 bytes long, but is fetched as a 16 bytes | |
112 | quantity. Up to here we have the elf_vrregset_t structure. | |
113 | Appended to this there is space for the VRSAVE register: 4 bytes. | |
114 | Even though this vrsave register is not included in the regset | |
115 | typedef, it is handled by the ptrace requests. | |
116 | ||
117 | Note that GNU/Linux doesn't support little endian PPC hardware, | |
118 | therefore the offset at which the real value of the VSCR register | |
119 | is located will be always 12 bytes. | |
120 | ||
121 | The layout is like this (where x is the actual value of the vscr reg): */ | |
122 | ||
123 | /* *INDENT-OFF* */ | |
124 | /* | |
125 | |.|.|.|.|.....|.|.|.|.||.|.|.|x||.| | |
126 | <-------> <-------><-------><-> | |
127 | VR0 VR31 VSCR VRSAVE | |
128 | */ | |
129 | /* *INDENT-ON* */ | |
130 | ||
131 | #define SIZEOF_VRREGS 33*16+4 | |
132 | ||
133 | typedef char gdb_vrregset_t[SIZEOF_VRREGS]; | |
134 | ||
604c2f83 LM |
135 | /* This is the layout of the POWER7 VSX registers and the way they overlap |
136 | with the existing FPR and VMX registers. | |
137 | ||
138 | VSR doubleword 0 VSR doubleword 1 | |
139 | ---------------------------------------------------------------- | |
140 | VSR[0] | FPR[0] | | | |
141 | ---------------------------------------------------------------- | |
142 | VSR[1] | FPR[1] | | | |
143 | ---------------------------------------------------------------- | |
144 | | ... | | | |
145 | | ... | | | |
146 | ---------------------------------------------------------------- | |
147 | VSR[30] | FPR[30] | | | |
148 | ---------------------------------------------------------------- | |
149 | VSR[31] | FPR[31] | | | |
150 | ---------------------------------------------------------------- | |
151 | VSR[32] | VR[0] | | |
152 | ---------------------------------------------------------------- | |
153 | VSR[33] | VR[1] | | |
154 | ---------------------------------------------------------------- | |
155 | | ... | | |
156 | | ... | | |
157 | ---------------------------------------------------------------- | |
158 | VSR[62] | VR[30] | | |
159 | ---------------------------------------------------------------- | |
160 | VSR[63] | VR[31] | | |
161 | ---------------------------------------------------------------- | |
162 | ||
163 | VSX has 64 128bit registers. The first 32 registers overlap with | |
164 | the FP registers (doubleword 0) and hence extend them with additional | |
165 | 64 bits (doubleword 1). The other 32 regs overlap with the VMX | |
166 | registers. */ | |
167 | #define SIZEOF_VSXREGS 32*8 | |
168 | ||
169 | typedef char gdb_vsxregset_t[SIZEOF_VSXREGS]; | |
01904826 JB |
170 | |
171 | /* On PPC processors that support the the Signal Processing Extension | |
172 | (SPE) APU, the general-purpose registers are 64 bits long. | |
411cb3f9 PG |
173 | However, the ordinary Linux kernel PTRACE_PEEKUSER / PTRACE_POKEUSER |
174 | ptrace calls only access the lower half of each register, to allow | |
175 | them to behave the same way they do on non-SPE systems. There's a | |
176 | separate pair of calls, PTRACE_GETEVRREGS / PTRACE_SETEVRREGS, that | |
177 | read and write the top halves of all the general-purpose registers | |
178 | at once, along with some SPE-specific registers. | |
01904826 JB |
179 | |
180 | GDB itself continues to claim the general-purpose registers are 32 | |
6ced10dd JB |
181 | bits long. It has unnamed raw registers that hold the upper halves |
182 | of the gprs, and the the full 64-bit SIMD views of the registers, | |
183 | 'ev0' -- 'ev31', are pseudo-registers that splice the top and | |
184 | bottom halves together. | |
01904826 JB |
185 | |
186 | This is the structure filled in by PTRACE_GETEVRREGS and written to | |
187 | the inferior's registers by PTRACE_SETEVRREGS. */ | |
188 | struct gdb_evrregset_t | |
189 | { | |
190 | unsigned long evr[32]; | |
191 | unsigned long long acc; | |
192 | unsigned long spefscr; | |
193 | }; | |
194 | ||
604c2f83 LM |
195 | /* Non-zero if our kernel may support the PTRACE_GETVSXREGS and |
196 | PTRACE_SETVSXREGS requests, for reading and writing the VSX | |
197 | POWER7 registers 0 through 31. Zero if we've tried one of them and | |
198 | gotten an error. Note that VSX registers 32 through 63 overlap | |
199 | with VR registers 0 through 31. */ | |
200 | int have_ptrace_getsetvsxregs = 1; | |
01904826 JB |
201 | |
202 | /* Non-zero if our kernel may support the PTRACE_GETVRREGS and | |
203 | PTRACE_SETVRREGS requests, for reading and writing the Altivec | |
204 | registers. Zero if we've tried one of them and gotten an | |
205 | error. */ | |
9abe5450 EZ |
206 | int have_ptrace_getvrregs = 1; |
207 | ||
01904826 JB |
208 | /* Non-zero if our kernel may support the PTRACE_GETEVRREGS and |
209 | PTRACE_SETEVRREGS requests, for reading and writing the SPE | |
210 | registers. Zero if we've tried one of them and gotten an | |
211 | error. */ | |
212 | int have_ptrace_getsetevrregs = 1; | |
213 | ||
16333c4f EZ |
214 | /* *INDENT-OFF* */ |
215 | /* registers layout, as presented by the ptrace interface: | |
216 | PT_R0, PT_R1, PT_R2, PT_R3, PT_R4, PT_R5, PT_R6, PT_R7, | |
217 | PT_R8, PT_R9, PT_R10, PT_R11, PT_R12, PT_R13, PT_R14, PT_R15, | |
218 | PT_R16, PT_R17, PT_R18, PT_R19, PT_R20, PT_R21, PT_R22, PT_R23, | |
219 | PT_R24, PT_R25, PT_R26, PT_R27, PT_R28, PT_R29, PT_R30, PT_R31, | |
220 | PT_FPR0, PT_FPR0 + 2, PT_FPR0 + 4, PT_FPR0 + 6, PT_FPR0 + 8, PT_FPR0 + 10, PT_FPR0 + 12, PT_FPR0 + 14, | |
221 | PT_FPR0 + 16, PT_FPR0 + 18, PT_FPR0 + 20, PT_FPR0 + 22, PT_FPR0 + 24, PT_FPR0 + 26, PT_FPR0 + 28, PT_FPR0 + 30, | |
222 | PT_FPR0 + 32, PT_FPR0 + 34, PT_FPR0 + 36, PT_FPR0 + 38, PT_FPR0 + 40, PT_FPR0 + 42, PT_FPR0 + 44, PT_FPR0 + 46, | |
223 | PT_FPR0 + 48, PT_FPR0 + 50, PT_FPR0 + 52, PT_FPR0 + 54, PT_FPR0 + 56, PT_FPR0 + 58, PT_FPR0 + 60, PT_FPR0 + 62, | |
224 | PT_NIP, PT_MSR, PT_CCR, PT_LNK, PT_CTR, PT_XER, PT_MQ */ | |
225 | /* *INDENT_ON * */ | |
c877c8e6 | 226 | |
45229ea4 | 227 | static int |
e101270f | 228 | ppc_register_u_addr (struct gdbarch *gdbarch, int regno) |
c877c8e6 | 229 | { |
16333c4f | 230 | int u_addr = -1; |
e101270f | 231 | struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); |
56d0d96a AC |
232 | /* NOTE: cagney/2003-11-25: This is the word size used by the ptrace |
233 | interface, and not the wordsize of the program's ABI. */ | |
411cb3f9 | 234 | int wordsize = sizeof (long); |
16333c4f EZ |
235 | |
236 | /* General purpose registers occupy 1 slot each in the buffer */ | |
8bf659e8 JB |
237 | if (regno >= tdep->ppc_gp0_regnum |
238 | && regno < tdep->ppc_gp0_regnum + ppc_num_gprs) | |
26e75e5c | 239 | u_addr = ((regno - tdep->ppc_gp0_regnum + PT_R0) * wordsize); |
16333c4f | 240 | |
49ff75ad JB |
241 | /* Floating point regs: eight bytes each in both 32- and 64-bit |
242 | ptrace interfaces. Thus, two slots each in 32-bit interface, one | |
243 | slot each in 64-bit interface. */ | |
383f0f5b JB |
244 | if (tdep->ppc_fp0_regnum >= 0 |
245 | && regno >= tdep->ppc_fp0_regnum | |
366f009f JB |
246 | && regno < tdep->ppc_fp0_regnum + ppc_num_fprs) |
247 | u_addr = (PT_FPR0 * wordsize) + ((regno - tdep->ppc_fp0_regnum) * 8); | |
16333c4f EZ |
248 | |
249 | /* UISA special purpose registers: 1 slot each */ | |
e101270f | 250 | if (regno == gdbarch_pc_regnum (gdbarch)) |
49ff75ad | 251 | u_addr = PT_NIP * wordsize; |
dc5cfeb6 | 252 | if (regno == tdep->ppc_lr_regnum) |
49ff75ad | 253 | u_addr = PT_LNK * wordsize; |
dc5cfeb6 | 254 | if (regno == tdep->ppc_cr_regnum) |
49ff75ad | 255 | u_addr = PT_CCR * wordsize; |
dc5cfeb6 | 256 | if (regno == tdep->ppc_xer_regnum) |
49ff75ad | 257 | u_addr = PT_XER * wordsize; |
dc5cfeb6 | 258 | if (regno == tdep->ppc_ctr_regnum) |
49ff75ad | 259 | u_addr = PT_CTR * wordsize; |
f8c59253 | 260 | #ifdef PT_MQ |
dc5cfeb6 | 261 | if (regno == tdep->ppc_mq_regnum) |
49ff75ad | 262 | u_addr = PT_MQ * wordsize; |
f8c59253 | 263 | #endif |
dc5cfeb6 | 264 | if (regno == tdep->ppc_ps_regnum) |
49ff75ad | 265 | u_addr = PT_MSR * wordsize; |
7284e1be UW |
266 | if (regno == PPC_ORIG_R3_REGNUM) |
267 | u_addr = PT_ORIG_R3 * wordsize; | |
268 | if (regno == PPC_TRAP_REGNUM) | |
269 | u_addr = PT_TRAP * wordsize; | |
383f0f5b JB |
270 | if (tdep->ppc_fpscr_regnum >= 0 |
271 | && regno == tdep->ppc_fpscr_regnum) | |
8f135812 AC |
272 | { |
273 | /* NOTE: cagney/2005-02-08: On some 64-bit GNU/Linux systems the | |
274 | kernel headers incorrectly contained the 32-bit definition of | |
275 | PT_FPSCR. For the 32-bit definition, floating-point | |
276 | registers occupy two 32-bit "slots", and the FPSCR lives in | |
277 | the secondhalf of such a slot-pair (hence +1). For 64-bit, | |
278 | the FPSCR instead occupies the full 64-bit 2-word-slot and | |
279 | hence no adjustment is necessary. Hack around this. */ | |
280 | if (wordsize == 8 && PT_FPSCR == (48 + 32 + 1)) | |
281 | u_addr = (48 + 32) * wordsize; | |
282 | else | |
283 | u_addr = PT_FPSCR * wordsize; | |
284 | } | |
16333c4f | 285 | return u_addr; |
c877c8e6 KB |
286 | } |
287 | ||
604c2f83 LM |
288 | /* The Linux kernel ptrace interface for POWER7 VSX registers uses the |
289 | registers set mechanism, as opposed to the interface for all the | |
290 | other registers, that stores/fetches each register individually. */ | |
291 | static void | |
292 | fetch_vsx_register (struct regcache *regcache, int tid, int regno) | |
293 | { | |
294 | int ret; | |
295 | gdb_vsxregset_t regs; | |
296 | struct gdbarch *gdbarch = get_regcache_arch (regcache); | |
297 | struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); | |
298 | int vsxregsize = register_size (gdbarch, tdep->ppc_vsr0_upper_regnum); | |
299 | ||
300 | ret = ptrace (PTRACE_GETVSXREGS, tid, 0, ®s); | |
301 | if (ret < 0) | |
302 | { | |
303 | if (errno == EIO) | |
304 | { | |
305 | have_ptrace_getsetvsxregs = 0; | |
306 | return; | |
307 | } | |
308 | perror_with_name (_("Unable to fetch VSX register")); | |
309 | } | |
310 | ||
311 | regcache_raw_supply (regcache, regno, | |
312 | regs + (regno - tdep->ppc_vsr0_upper_regnum) | |
313 | * vsxregsize); | |
314 | } | |
315 | ||
9abe5450 EZ |
316 | /* The Linux kernel ptrace interface for AltiVec registers uses the |
317 | registers set mechanism, as opposed to the interface for all the | |
318 | other registers, that stores/fetches each register individually. */ | |
319 | static void | |
56be3814 | 320 | fetch_altivec_register (struct regcache *regcache, int tid, int regno) |
9abe5450 EZ |
321 | { |
322 | int ret; | |
323 | int offset = 0; | |
324 | gdb_vrregset_t regs; | |
40a6adc1 MD |
325 | struct gdbarch *gdbarch = get_regcache_arch (regcache); |
326 | struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); | |
327 | int vrregsize = register_size (gdbarch, tdep->ppc_vr0_regnum); | |
9abe5450 EZ |
328 | |
329 | ret = ptrace (PTRACE_GETVRREGS, tid, 0, ®s); | |
330 | if (ret < 0) | |
331 | { | |
332 | if (errno == EIO) | |
333 | { | |
334 | have_ptrace_getvrregs = 0; | |
335 | return; | |
336 | } | |
e2e0b3e5 | 337 | perror_with_name (_("Unable to fetch AltiVec register")); |
9abe5450 EZ |
338 | } |
339 | ||
340 | /* VSCR is fetched as a 16 bytes quantity, but it is really 4 bytes | |
341 | long on the hardware. We deal only with the lower 4 bytes of the | |
342 | vector. VRSAVE is at the end of the array in a 4 bytes slot, so | |
343 | there is no need to define an offset for it. */ | |
344 | if (regno == (tdep->ppc_vrsave_regnum - 1)) | |
40a6adc1 | 345 | offset = vrregsize - register_size (gdbarch, tdep->ppc_vrsave_regnum); |
9abe5450 | 346 | |
56be3814 | 347 | regcache_raw_supply (regcache, regno, |
23a6d369 | 348 | regs + (regno - tdep->ppc_vr0_regnum) * vrregsize + offset); |
9abe5450 EZ |
349 | } |
350 | ||
01904826 JB |
351 | /* Fetch the top 32 bits of TID's general-purpose registers and the |
352 | SPE-specific registers, and place the results in EVRREGSET. If we | |
353 | don't support PTRACE_GETEVRREGS, then just fill EVRREGSET with | |
354 | zeros. | |
355 | ||
356 | All the logic to deal with whether or not the PTRACE_GETEVRREGS and | |
357 | PTRACE_SETEVRREGS requests are supported is isolated here, and in | |
358 | set_spe_registers. */ | |
359 | static void | |
360 | get_spe_registers (int tid, struct gdb_evrregset_t *evrregset) | |
361 | { | |
362 | if (have_ptrace_getsetevrregs) | |
363 | { | |
364 | if (ptrace (PTRACE_GETEVRREGS, tid, 0, evrregset) >= 0) | |
365 | return; | |
366 | else | |
367 | { | |
368 | /* EIO means that the PTRACE_GETEVRREGS request isn't supported; | |
369 | we just return zeros. */ | |
370 | if (errno == EIO) | |
371 | have_ptrace_getsetevrregs = 0; | |
372 | else | |
373 | /* Anything else needs to be reported. */ | |
e2e0b3e5 | 374 | perror_with_name (_("Unable to fetch SPE registers")); |
01904826 JB |
375 | } |
376 | } | |
377 | ||
378 | memset (evrregset, 0, sizeof (*evrregset)); | |
379 | } | |
380 | ||
6ced10dd JB |
381 | /* Supply values from TID for SPE-specific raw registers: the upper |
382 | halves of the GPRs, the accumulator, and the spefscr. REGNO must | |
383 | be the number of an upper half register, acc, spefscr, or -1 to | |
384 | supply the values of all registers. */ | |
01904826 | 385 | static void |
56be3814 | 386 | fetch_spe_register (struct regcache *regcache, int tid, int regno) |
01904826 | 387 | { |
40a6adc1 MD |
388 | struct gdbarch *gdbarch = get_regcache_arch (regcache); |
389 | struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); | |
01904826 JB |
390 | struct gdb_evrregset_t evrregs; |
391 | ||
6ced10dd | 392 | gdb_assert (sizeof (evrregs.evr[0]) |
40a6adc1 | 393 | == register_size (gdbarch, tdep->ppc_ev0_upper_regnum)); |
6ced10dd | 394 | gdb_assert (sizeof (evrregs.acc) |
40a6adc1 | 395 | == register_size (gdbarch, tdep->ppc_acc_regnum)); |
6ced10dd | 396 | gdb_assert (sizeof (evrregs.spefscr) |
40a6adc1 | 397 | == register_size (gdbarch, tdep->ppc_spefscr_regnum)); |
6ced10dd | 398 | |
01904826 JB |
399 | get_spe_registers (tid, &evrregs); |
400 | ||
6ced10dd | 401 | if (regno == -1) |
01904826 | 402 | { |
6ced10dd JB |
403 | int i; |
404 | ||
405 | for (i = 0; i < ppc_num_gprs; i++) | |
56be3814 | 406 | regcache_raw_supply (regcache, tdep->ppc_ev0_upper_regnum + i, |
6ced10dd | 407 | &evrregs.evr[i]); |
01904826 | 408 | } |
6ced10dd JB |
409 | else if (tdep->ppc_ev0_upper_regnum <= regno |
410 | && regno < tdep->ppc_ev0_upper_regnum + ppc_num_gprs) | |
56be3814 | 411 | regcache_raw_supply (regcache, regno, |
6ced10dd JB |
412 | &evrregs.evr[regno - tdep->ppc_ev0_upper_regnum]); |
413 | ||
414 | if (regno == -1 | |
415 | || regno == tdep->ppc_acc_regnum) | |
56be3814 | 416 | regcache_raw_supply (regcache, tdep->ppc_acc_regnum, &evrregs.acc); |
6ced10dd JB |
417 | |
418 | if (regno == -1 | |
419 | || regno == tdep->ppc_spefscr_regnum) | |
56be3814 | 420 | regcache_raw_supply (regcache, tdep->ppc_spefscr_regnum, |
6ced10dd | 421 | &evrregs.spefscr); |
01904826 JB |
422 | } |
423 | ||
45229ea4 | 424 | static void |
56be3814 | 425 | fetch_register (struct regcache *regcache, int tid, int regno) |
45229ea4 | 426 | { |
40a6adc1 MD |
427 | struct gdbarch *gdbarch = get_regcache_arch (regcache); |
428 | struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); | |
45229ea4 | 429 | /* This isn't really an address. But ptrace thinks of it as one. */ |
e101270f | 430 | CORE_ADDR regaddr = ppc_register_u_addr (gdbarch, regno); |
4a19ea35 | 431 | int bytes_transferred; |
45229ea4 | 432 | unsigned int offset; /* Offset of registers within the u area. */ |
d9d9c31f | 433 | char buf[MAX_REGISTER_SIZE]; |
45229ea4 | 434 | |
be8626e0 | 435 | if (altivec_register_p (gdbarch, regno)) |
9abe5450 EZ |
436 | { |
437 | /* If this is the first time through, or if it is not the first | |
438 | time through, and we have comfirmed that there is kernel | |
439 | support for such a ptrace request, then go and fetch the | |
440 | register. */ | |
441 | if (have_ptrace_getvrregs) | |
442 | { | |
56be3814 | 443 | fetch_altivec_register (regcache, tid, regno); |
9abe5450 EZ |
444 | return; |
445 | } | |
446 | /* If we have discovered that there is no ptrace support for | |
447 | AltiVec registers, fall through and return zeroes, because | |
448 | regaddr will be -1 in this case. */ | |
449 | } | |
604c2f83 LM |
450 | if (vsx_register_p (gdbarch, regno)) |
451 | { | |
452 | if (have_ptrace_getsetvsxregs) | |
453 | { | |
454 | fetch_vsx_register (regcache, tid, regno); | |
455 | return; | |
456 | } | |
457 | } | |
be8626e0 | 458 | else if (spe_register_p (gdbarch, regno)) |
01904826 | 459 | { |
56be3814 | 460 | fetch_spe_register (regcache, tid, regno); |
01904826 JB |
461 | return; |
462 | } | |
9abe5450 | 463 | |
45229ea4 EZ |
464 | if (regaddr == -1) |
465 | { | |
40a6adc1 | 466 | memset (buf, '\0', register_size (gdbarch, regno)); /* Supply zeroes */ |
56be3814 | 467 | regcache_raw_supply (regcache, regno, buf); |
45229ea4 EZ |
468 | return; |
469 | } | |
470 | ||
411cb3f9 | 471 | /* Read the raw register using sizeof(long) sized chunks. On a |
56d0d96a AC |
472 | 32-bit platform, 64-bit floating-point registers will require two |
473 | transfers. */ | |
4a19ea35 | 474 | for (bytes_transferred = 0; |
40a6adc1 | 475 | bytes_transferred < register_size (gdbarch, regno); |
411cb3f9 | 476 | bytes_transferred += sizeof (long)) |
45229ea4 EZ |
477 | { |
478 | errno = 0; | |
411cb3f9 PG |
479 | *(long *) &buf[bytes_transferred] |
480 | = ptrace (PTRACE_PEEKUSER, tid, (PTRACE_TYPE_ARG3) regaddr, 0); | |
481 | regaddr += sizeof (long); | |
45229ea4 EZ |
482 | if (errno != 0) |
483 | { | |
bc97b3ba JB |
484 | char message[128]; |
485 | sprintf (message, "reading register %s (#%d)", | |
40a6adc1 | 486 | gdbarch_register_name (gdbarch, regno), regno); |
bc97b3ba | 487 | perror_with_name (message); |
45229ea4 EZ |
488 | } |
489 | } | |
56d0d96a | 490 | |
4a19ea35 JB |
491 | /* Now supply the register. Keep in mind that the regcache's idea |
492 | of the register's size may not be a multiple of sizeof | |
411cb3f9 | 493 | (long). */ |
40a6adc1 | 494 | if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE) |
4a19ea35 JB |
495 | { |
496 | /* Little-endian values are always found at the left end of the | |
497 | bytes transferred. */ | |
56be3814 | 498 | regcache_raw_supply (regcache, regno, buf); |
4a19ea35 | 499 | } |
40a6adc1 | 500 | else if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) |
4a19ea35 JB |
501 | { |
502 | /* Big-endian values are found at the right end of the bytes | |
503 | transferred. */ | |
40a6adc1 | 504 | size_t padding = (bytes_transferred - register_size (gdbarch, regno)); |
56be3814 | 505 | regcache_raw_supply (regcache, regno, buf + padding); |
4a19ea35 JB |
506 | } |
507 | else | |
a44bddec | 508 | internal_error (__FILE__, __LINE__, |
e2e0b3e5 | 509 | _("fetch_register: unexpected byte order: %d"), |
40a6adc1 | 510 | gdbarch_byte_order (gdbarch)); |
45229ea4 EZ |
511 | } |
512 | ||
604c2f83 LM |
513 | static void |
514 | supply_vsxregset (struct regcache *regcache, gdb_vsxregset_t *vsxregsetp) | |
515 | { | |
516 | int i; | |
517 | struct gdbarch *gdbarch = get_regcache_arch (regcache); | |
518 | struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); | |
519 | int vsxregsize = register_size (gdbarch, tdep->ppc_vsr0_upper_regnum); | |
520 | ||
521 | for (i = 0; i < ppc_num_vshrs; i++) | |
522 | { | |
523 | regcache_raw_supply (regcache, tdep->ppc_vsr0_upper_regnum + i, | |
524 | *vsxregsetp + i * vsxregsize); | |
525 | } | |
526 | } | |
527 | ||
9abe5450 | 528 | static void |
56be3814 | 529 | supply_vrregset (struct regcache *regcache, gdb_vrregset_t *vrregsetp) |
9abe5450 EZ |
530 | { |
531 | int i; | |
40a6adc1 MD |
532 | struct gdbarch *gdbarch = get_regcache_arch (regcache); |
533 | struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); | |
9abe5450 | 534 | int num_of_vrregs = tdep->ppc_vrsave_regnum - tdep->ppc_vr0_regnum + 1; |
40a6adc1 MD |
535 | int vrregsize = register_size (gdbarch, tdep->ppc_vr0_regnum); |
536 | int offset = vrregsize - register_size (gdbarch, tdep->ppc_vrsave_regnum); | |
9abe5450 EZ |
537 | |
538 | for (i = 0; i < num_of_vrregs; i++) | |
539 | { | |
540 | /* The last 2 registers of this set are only 32 bit long, not | |
541 | 128. However an offset is necessary only for VSCR because it | |
542 | occupies a whole vector, while VRSAVE occupies a full 4 bytes | |
543 | slot. */ | |
544 | if (i == (num_of_vrregs - 2)) | |
56be3814 | 545 | regcache_raw_supply (regcache, tdep->ppc_vr0_regnum + i, |
23a6d369 | 546 | *vrregsetp + i * vrregsize + offset); |
9abe5450 | 547 | else |
56be3814 | 548 | regcache_raw_supply (regcache, tdep->ppc_vr0_regnum + i, |
23a6d369 | 549 | *vrregsetp + i * vrregsize); |
9abe5450 EZ |
550 | } |
551 | } | |
552 | ||
604c2f83 LM |
553 | static void |
554 | fetch_vsx_registers (struct regcache *regcache, int tid) | |
555 | { | |
556 | int ret; | |
557 | gdb_vsxregset_t regs; | |
558 | ||
559 | ret = ptrace (PTRACE_GETVSXREGS, tid, 0, ®s); | |
560 | if (ret < 0) | |
561 | { | |
562 | if (errno == EIO) | |
563 | { | |
564 | have_ptrace_getsetvsxregs = 0; | |
565 | return; | |
566 | } | |
567 | perror_with_name (_("Unable to fetch VSX registers")); | |
568 | } | |
569 | supply_vsxregset (regcache, ®s); | |
570 | } | |
571 | ||
9abe5450 | 572 | static void |
56be3814 | 573 | fetch_altivec_registers (struct regcache *regcache, int tid) |
9abe5450 EZ |
574 | { |
575 | int ret; | |
576 | gdb_vrregset_t regs; | |
577 | ||
578 | ret = ptrace (PTRACE_GETVRREGS, tid, 0, ®s); | |
579 | if (ret < 0) | |
580 | { | |
581 | if (errno == EIO) | |
582 | { | |
583 | have_ptrace_getvrregs = 0; | |
584 | return; | |
585 | } | |
e2e0b3e5 | 586 | perror_with_name (_("Unable to fetch AltiVec registers")); |
9abe5450 | 587 | } |
56be3814 | 588 | supply_vrregset (regcache, ®s); |
9abe5450 EZ |
589 | } |
590 | ||
45229ea4 | 591 | static void |
56be3814 | 592 | fetch_ppc_registers (struct regcache *regcache, int tid) |
45229ea4 EZ |
593 | { |
594 | int i; | |
40a6adc1 MD |
595 | struct gdbarch *gdbarch = get_regcache_arch (regcache); |
596 | struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); | |
9abe5450 | 597 | |
6ced10dd | 598 | for (i = 0; i < ppc_num_gprs; i++) |
56be3814 | 599 | fetch_register (regcache, tid, tdep->ppc_gp0_regnum + i); |
32b99774 JB |
600 | if (tdep->ppc_fp0_regnum >= 0) |
601 | for (i = 0; i < ppc_num_fprs; i++) | |
56be3814 | 602 | fetch_register (regcache, tid, tdep->ppc_fp0_regnum + i); |
40a6adc1 | 603 | fetch_register (regcache, tid, gdbarch_pc_regnum (gdbarch)); |
32b99774 | 604 | if (tdep->ppc_ps_regnum != -1) |
56be3814 | 605 | fetch_register (regcache, tid, tdep->ppc_ps_regnum); |
32b99774 | 606 | if (tdep->ppc_cr_regnum != -1) |
56be3814 | 607 | fetch_register (regcache, tid, tdep->ppc_cr_regnum); |
32b99774 | 608 | if (tdep->ppc_lr_regnum != -1) |
56be3814 | 609 | fetch_register (regcache, tid, tdep->ppc_lr_regnum); |
32b99774 | 610 | if (tdep->ppc_ctr_regnum != -1) |
56be3814 | 611 | fetch_register (regcache, tid, tdep->ppc_ctr_regnum); |
32b99774 | 612 | if (tdep->ppc_xer_regnum != -1) |
56be3814 | 613 | fetch_register (regcache, tid, tdep->ppc_xer_regnum); |
e3f36dbd | 614 | if (tdep->ppc_mq_regnum != -1) |
56be3814 | 615 | fetch_register (regcache, tid, tdep->ppc_mq_regnum); |
7284e1be UW |
616 | if (ppc_linux_trap_reg_p (gdbarch)) |
617 | { | |
618 | fetch_register (regcache, tid, PPC_ORIG_R3_REGNUM); | |
619 | fetch_register (regcache, tid, PPC_TRAP_REGNUM); | |
620 | } | |
32b99774 | 621 | if (tdep->ppc_fpscr_regnum != -1) |
56be3814 | 622 | fetch_register (regcache, tid, tdep->ppc_fpscr_regnum); |
9abe5450 EZ |
623 | if (have_ptrace_getvrregs) |
624 | if (tdep->ppc_vr0_regnum != -1 && tdep->ppc_vrsave_regnum != -1) | |
56be3814 | 625 | fetch_altivec_registers (regcache, tid); |
604c2f83 LM |
626 | if (have_ptrace_getsetvsxregs) |
627 | if (tdep->ppc_vsr0_upper_regnum != -1) | |
628 | fetch_vsx_registers (regcache, tid); | |
6ced10dd | 629 | if (tdep->ppc_ev0_upper_regnum >= 0) |
56be3814 | 630 | fetch_spe_register (regcache, tid, -1); |
45229ea4 EZ |
631 | } |
632 | ||
633 | /* Fetch registers from the child process. Fetch all registers if | |
634 | regno == -1, otherwise fetch all general registers or all floating | |
635 | point registers depending upon the value of regno. */ | |
10d6c8cd | 636 | static void |
56be3814 | 637 | ppc_linux_fetch_inferior_registers (struct regcache *regcache, int regno) |
45229ea4 | 638 | { |
9abe5450 | 639 | /* Overload thread id onto process id */ |
05f13b9c EZ |
640 | int tid = TIDGET (inferior_ptid); |
641 | ||
642 | /* No thread id, just use process id */ | |
643 | if (tid == 0) | |
644 | tid = PIDGET (inferior_ptid); | |
645 | ||
9abe5450 | 646 | if (regno == -1) |
56be3814 | 647 | fetch_ppc_registers (regcache, tid); |
45229ea4 | 648 | else |
56be3814 | 649 | fetch_register (regcache, tid, regno); |
45229ea4 EZ |
650 | } |
651 | ||
604c2f83 LM |
652 | /* Store one VSX register. */ |
653 | static void | |
654 | store_vsx_register (const struct regcache *regcache, int tid, int regno) | |
655 | { | |
656 | int ret; | |
657 | gdb_vsxregset_t regs; | |
658 | struct gdbarch *gdbarch = get_regcache_arch (regcache); | |
659 | struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); | |
660 | int vsxregsize = register_size (gdbarch, tdep->ppc_vsr0_upper_regnum); | |
661 | ||
662 | ret = ptrace (PTRACE_SETVSXREGS, tid, 0, ®s); | |
663 | if (ret < 0) | |
664 | { | |
665 | if (errno == EIO) | |
666 | { | |
667 | have_ptrace_getsetvsxregs = 0; | |
668 | return; | |
669 | } | |
670 | perror_with_name (_("Unable to fetch VSX register")); | |
671 | } | |
672 | ||
673 | regcache_raw_collect (regcache, regno, regs + | |
674 | (regno - tdep->ppc_vsr0_upper_regnum) * vsxregsize); | |
675 | ||
676 | ret = ptrace (PTRACE_SETVSXREGS, tid, 0, ®s); | |
677 | if (ret < 0) | |
678 | perror_with_name (_("Unable to store VSX register")); | |
679 | } | |
680 | ||
45229ea4 | 681 | /* Store one register. */ |
9abe5450 | 682 | static void |
56be3814 | 683 | store_altivec_register (const struct regcache *regcache, int tid, int regno) |
9abe5450 EZ |
684 | { |
685 | int ret; | |
686 | int offset = 0; | |
687 | gdb_vrregset_t regs; | |
40a6adc1 MD |
688 | struct gdbarch *gdbarch = get_regcache_arch (regcache); |
689 | struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); | |
690 | int vrregsize = register_size (gdbarch, tdep->ppc_vr0_regnum); | |
9abe5450 EZ |
691 | |
692 | ret = ptrace (PTRACE_GETVRREGS, tid, 0, ®s); | |
693 | if (ret < 0) | |
694 | { | |
695 | if (errno == EIO) | |
696 | { | |
697 | have_ptrace_getvrregs = 0; | |
698 | return; | |
699 | } | |
e2e0b3e5 | 700 | perror_with_name (_("Unable to fetch AltiVec register")); |
9abe5450 EZ |
701 | } |
702 | ||
703 | /* VSCR is fetched as a 16 bytes quantity, but it is really 4 bytes | |
704 | long on the hardware. */ | |
705 | if (regno == (tdep->ppc_vrsave_regnum - 1)) | |
40a6adc1 | 706 | offset = vrregsize - register_size (gdbarch, tdep->ppc_vrsave_regnum); |
9abe5450 | 707 | |
56be3814 | 708 | regcache_raw_collect (regcache, regno, |
822c9732 | 709 | regs + (regno - tdep->ppc_vr0_regnum) * vrregsize + offset); |
9abe5450 EZ |
710 | |
711 | ret = ptrace (PTRACE_SETVRREGS, tid, 0, ®s); | |
712 | if (ret < 0) | |
e2e0b3e5 | 713 | perror_with_name (_("Unable to store AltiVec register")); |
9abe5450 EZ |
714 | } |
715 | ||
01904826 JB |
716 | /* Assuming TID referrs to an SPE process, set the top halves of TID's |
717 | general-purpose registers and its SPE-specific registers to the | |
718 | values in EVRREGSET. If we don't support PTRACE_SETEVRREGS, do | |
719 | nothing. | |
720 | ||
721 | All the logic to deal with whether or not the PTRACE_GETEVRREGS and | |
722 | PTRACE_SETEVRREGS requests are supported is isolated here, and in | |
723 | get_spe_registers. */ | |
724 | static void | |
725 | set_spe_registers (int tid, struct gdb_evrregset_t *evrregset) | |
726 | { | |
727 | if (have_ptrace_getsetevrregs) | |
728 | { | |
729 | if (ptrace (PTRACE_SETEVRREGS, tid, 0, evrregset) >= 0) | |
730 | return; | |
731 | else | |
732 | { | |
733 | /* EIO means that the PTRACE_SETEVRREGS request isn't | |
734 | supported; we fail silently, and don't try the call | |
735 | again. */ | |
736 | if (errno == EIO) | |
737 | have_ptrace_getsetevrregs = 0; | |
738 | else | |
739 | /* Anything else needs to be reported. */ | |
e2e0b3e5 | 740 | perror_with_name (_("Unable to set SPE registers")); |
01904826 JB |
741 | } |
742 | } | |
743 | } | |
744 | ||
6ced10dd JB |
745 | /* Write GDB's value for the SPE-specific raw register REGNO to TID. |
746 | If REGNO is -1, write the values of all the SPE-specific | |
747 | registers. */ | |
01904826 | 748 | static void |
56be3814 | 749 | store_spe_register (const struct regcache *regcache, int tid, int regno) |
01904826 | 750 | { |
40a6adc1 MD |
751 | struct gdbarch *gdbarch = get_regcache_arch (regcache); |
752 | struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); | |
01904826 JB |
753 | struct gdb_evrregset_t evrregs; |
754 | ||
6ced10dd | 755 | gdb_assert (sizeof (evrregs.evr[0]) |
40a6adc1 | 756 | == register_size (gdbarch, tdep->ppc_ev0_upper_regnum)); |
6ced10dd | 757 | gdb_assert (sizeof (evrregs.acc) |
40a6adc1 | 758 | == register_size (gdbarch, tdep->ppc_acc_regnum)); |
6ced10dd | 759 | gdb_assert (sizeof (evrregs.spefscr) |
40a6adc1 | 760 | == register_size (gdbarch, tdep->ppc_spefscr_regnum)); |
01904826 | 761 | |
6ced10dd JB |
762 | if (regno == -1) |
763 | /* Since we're going to write out every register, the code below | |
764 | should store to every field of evrregs; if that doesn't happen, | |
765 | make it obvious by initializing it with suspicious values. */ | |
766 | memset (&evrregs, 42, sizeof (evrregs)); | |
767 | else | |
768 | /* We can only read and write the entire EVR register set at a | |
769 | time, so to write just a single register, we do a | |
770 | read-modify-write maneuver. */ | |
771 | get_spe_registers (tid, &evrregs); | |
772 | ||
773 | if (regno == -1) | |
01904826 | 774 | { |
6ced10dd JB |
775 | int i; |
776 | ||
777 | for (i = 0; i < ppc_num_gprs; i++) | |
56be3814 | 778 | regcache_raw_collect (regcache, |
6ced10dd JB |
779 | tdep->ppc_ev0_upper_regnum + i, |
780 | &evrregs.evr[i]); | |
01904826 | 781 | } |
6ced10dd JB |
782 | else if (tdep->ppc_ev0_upper_regnum <= regno |
783 | && regno < tdep->ppc_ev0_upper_regnum + ppc_num_gprs) | |
56be3814 | 784 | regcache_raw_collect (regcache, regno, |
6ced10dd JB |
785 | &evrregs.evr[regno - tdep->ppc_ev0_upper_regnum]); |
786 | ||
787 | if (regno == -1 | |
788 | || regno == tdep->ppc_acc_regnum) | |
56be3814 | 789 | regcache_raw_collect (regcache, |
6ced10dd JB |
790 | tdep->ppc_acc_regnum, |
791 | &evrregs.acc); | |
792 | ||
793 | if (regno == -1 | |
794 | || regno == tdep->ppc_spefscr_regnum) | |
56be3814 | 795 | regcache_raw_collect (regcache, |
6ced10dd JB |
796 | tdep->ppc_spefscr_regnum, |
797 | &evrregs.spefscr); | |
01904826 JB |
798 | |
799 | /* Write back the modified register set. */ | |
800 | set_spe_registers (tid, &evrregs); | |
801 | } | |
802 | ||
45229ea4 | 803 | static void |
56be3814 | 804 | store_register (const struct regcache *regcache, int tid, int regno) |
45229ea4 | 805 | { |
40a6adc1 MD |
806 | struct gdbarch *gdbarch = get_regcache_arch (regcache); |
807 | struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); | |
45229ea4 | 808 | /* This isn't really an address. But ptrace thinks of it as one. */ |
e101270f | 809 | CORE_ADDR regaddr = ppc_register_u_addr (gdbarch, regno); |
52f0bd74 | 810 | int i; |
4a19ea35 | 811 | size_t bytes_to_transfer; |
d9d9c31f | 812 | char buf[MAX_REGISTER_SIZE]; |
45229ea4 | 813 | |
be8626e0 | 814 | if (altivec_register_p (gdbarch, regno)) |
45229ea4 | 815 | { |
56be3814 | 816 | store_altivec_register (regcache, tid, regno); |
45229ea4 EZ |
817 | return; |
818 | } | |
604c2f83 LM |
819 | if (vsx_register_p (gdbarch, regno)) |
820 | { | |
821 | store_vsx_register (regcache, tid, regno); | |
822 | return; | |
823 | } | |
be8626e0 | 824 | else if (spe_register_p (gdbarch, regno)) |
01904826 | 825 | { |
56be3814 | 826 | store_spe_register (regcache, tid, regno); |
01904826 JB |
827 | return; |
828 | } | |
45229ea4 | 829 | |
9abe5450 EZ |
830 | if (regaddr == -1) |
831 | return; | |
832 | ||
4a19ea35 JB |
833 | /* First collect the register. Keep in mind that the regcache's |
834 | idea of the register's size may not be a multiple of sizeof | |
411cb3f9 | 835 | (long). */ |
56d0d96a | 836 | memset (buf, 0, sizeof buf); |
40a6adc1 MD |
837 | bytes_to_transfer = align_up (register_size (gdbarch, regno), sizeof (long)); |
838 | if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE) | |
4a19ea35 JB |
839 | { |
840 | /* Little-endian values always sit at the left end of the buffer. */ | |
56be3814 | 841 | regcache_raw_collect (regcache, regno, buf); |
4a19ea35 | 842 | } |
40a6adc1 | 843 | else if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) |
4a19ea35 JB |
844 | { |
845 | /* Big-endian values sit at the right end of the buffer. */ | |
40a6adc1 | 846 | size_t padding = (bytes_to_transfer - register_size (gdbarch, regno)); |
56be3814 | 847 | regcache_raw_collect (regcache, regno, buf + padding); |
4a19ea35 JB |
848 | } |
849 | ||
411cb3f9 | 850 | for (i = 0; i < bytes_to_transfer; i += sizeof (long)) |
45229ea4 EZ |
851 | { |
852 | errno = 0; | |
411cb3f9 PG |
853 | ptrace (PTRACE_POKEUSER, tid, (PTRACE_TYPE_ARG3) regaddr, |
854 | *(long *) &buf[i]); | |
855 | regaddr += sizeof (long); | |
e3f36dbd KB |
856 | |
857 | if (errno == EIO | |
7284e1be UW |
858 | && (regno == tdep->ppc_fpscr_regnum |
859 | || regno == PPC_ORIG_R3_REGNUM | |
860 | || regno == PPC_TRAP_REGNUM)) | |
e3f36dbd | 861 | { |
7284e1be UW |
862 | /* Some older kernel versions don't allow fpscr, orig_r3 |
863 | or trap to be written. */ | |
e3f36dbd KB |
864 | continue; |
865 | } | |
866 | ||
45229ea4 EZ |
867 | if (errno != 0) |
868 | { | |
bc97b3ba JB |
869 | char message[128]; |
870 | sprintf (message, "writing register %s (#%d)", | |
40a6adc1 | 871 | gdbarch_register_name (gdbarch, regno), regno); |
bc97b3ba | 872 | perror_with_name (message); |
45229ea4 EZ |
873 | } |
874 | } | |
875 | } | |
876 | ||
604c2f83 LM |
877 | static void |
878 | fill_vsxregset (const struct regcache *regcache, gdb_vsxregset_t *vsxregsetp) | |
879 | { | |
880 | int i; | |
881 | struct gdbarch *gdbarch = get_regcache_arch (regcache); | |
882 | struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); | |
883 | int vsxregsize = register_size (gdbarch, tdep->ppc_vsr0_upper_regnum); | |
884 | ||
885 | for (i = 0; i < ppc_num_vshrs; i++) | |
886 | regcache_raw_collect (regcache, tdep->ppc_vsr0_upper_regnum + i, | |
887 | *vsxregsetp + i * vsxregsize); | |
888 | } | |
889 | ||
9abe5450 | 890 | static void |
56be3814 | 891 | fill_vrregset (const struct regcache *regcache, gdb_vrregset_t *vrregsetp) |
9abe5450 EZ |
892 | { |
893 | int i; | |
40a6adc1 MD |
894 | struct gdbarch *gdbarch = get_regcache_arch (regcache); |
895 | struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); | |
9abe5450 | 896 | int num_of_vrregs = tdep->ppc_vrsave_regnum - tdep->ppc_vr0_regnum + 1; |
40a6adc1 MD |
897 | int vrregsize = register_size (gdbarch, tdep->ppc_vr0_regnum); |
898 | int offset = vrregsize - register_size (gdbarch, tdep->ppc_vrsave_regnum); | |
9abe5450 EZ |
899 | |
900 | for (i = 0; i < num_of_vrregs; i++) | |
901 | { | |
902 | /* The last 2 registers of this set are only 32 bit long, not | |
903 | 128, but only VSCR is fetched as a 16 bytes quantity. */ | |
904 | if (i == (num_of_vrregs - 2)) | |
56be3814 | 905 | regcache_raw_collect (regcache, tdep->ppc_vr0_regnum + i, |
822c9732 | 906 | *vrregsetp + i * vrregsize + offset); |
9abe5450 | 907 | else |
56be3814 | 908 | regcache_raw_collect (regcache, tdep->ppc_vr0_regnum + i, |
822c9732 | 909 | *vrregsetp + i * vrregsize); |
9abe5450 EZ |
910 | } |
911 | } | |
912 | ||
604c2f83 LM |
913 | static void |
914 | store_vsx_registers (const struct regcache *regcache, int tid) | |
915 | { | |
916 | int ret; | |
917 | gdb_vsxregset_t regs; | |
918 | ||
919 | ret = ptrace (PTRACE_GETVSXREGS, tid, 0, ®s); | |
920 | if (ret < 0) | |
921 | { | |
922 | if (errno == EIO) | |
923 | { | |
924 | have_ptrace_getsetvsxregs = 0; | |
925 | return; | |
926 | } | |
927 | perror_with_name (_("Couldn't get VSX registers")); | |
928 | } | |
929 | ||
930 | fill_vsxregset (regcache, ®s); | |
931 | ||
932 | if (ptrace (PTRACE_SETVSXREGS, tid, 0, ®s) < 0) | |
933 | perror_with_name (_("Couldn't write VSX registers")); | |
934 | } | |
935 | ||
9abe5450 | 936 | static void |
56be3814 | 937 | store_altivec_registers (const struct regcache *regcache, int tid) |
9abe5450 EZ |
938 | { |
939 | int ret; | |
940 | gdb_vrregset_t regs; | |
941 | ||
0897f59b | 942 | ret = ptrace (PTRACE_GETVRREGS, tid, 0, ®s); |
9abe5450 EZ |
943 | if (ret < 0) |
944 | { | |
945 | if (errno == EIO) | |
946 | { | |
947 | have_ptrace_getvrregs = 0; | |
948 | return; | |
949 | } | |
e2e0b3e5 | 950 | perror_with_name (_("Couldn't get AltiVec registers")); |
9abe5450 EZ |
951 | } |
952 | ||
56be3814 | 953 | fill_vrregset (regcache, ®s); |
9abe5450 | 954 | |
0897f59b | 955 | if (ptrace (PTRACE_SETVRREGS, tid, 0, ®s) < 0) |
e2e0b3e5 | 956 | perror_with_name (_("Couldn't write AltiVec registers")); |
9abe5450 EZ |
957 | } |
958 | ||
45229ea4 | 959 | static void |
56be3814 | 960 | store_ppc_registers (const struct regcache *regcache, int tid) |
45229ea4 EZ |
961 | { |
962 | int i; | |
40a6adc1 MD |
963 | struct gdbarch *gdbarch = get_regcache_arch (regcache); |
964 | struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); | |
45229ea4 | 965 | |
6ced10dd | 966 | for (i = 0; i < ppc_num_gprs; i++) |
56be3814 | 967 | store_register (regcache, tid, tdep->ppc_gp0_regnum + i); |
32b99774 JB |
968 | if (tdep->ppc_fp0_regnum >= 0) |
969 | for (i = 0; i < ppc_num_fprs; i++) | |
56be3814 | 970 | store_register (regcache, tid, tdep->ppc_fp0_regnum + i); |
40a6adc1 | 971 | store_register (regcache, tid, gdbarch_pc_regnum (gdbarch)); |
32b99774 | 972 | if (tdep->ppc_ps_regnum != -1) |
56be3814 | 973 | store_register (regcache, tid, tdep->ppc_ps_regnum); |
32b99774 | 974 | if (tdep->ppc_cr_regnum != -1) |
56be3814 | 975 | store_register (regcache, tid, tdep->ppc_cr_regnum); |
32b99774 | 976 | if (tdep->ppc_lr_regnum != -1) |
56be3814 | 977 | store_register (regcache, tid, tdep->ppc_lr_regnum); |
32b99774 | 978 | if (tdep->ppc_ctr_regnum != -1) |
56be3814 | 979 | store_register (regcache, tid, tdep->ppc_ctr_regnum); |
32b99774 | 980 | if (tdep->ppc_xer_regnum != -1) |
56be3814 | 981 | store_register (regcache, tid, tdep->ppc_xer_regnum); |
e3f36dbd | 982 | if (tdep->ppc_mq_regnum != -1) |
56be3814 | 983 | store_register (regcache, tid, tdep->ppc_mq_regnum); |
32b99774 | 984 | if (tdep->ppc_fpscr_regnum != -1) |
56be3814 | 985 | store_register (regcache, tid, tdep->ppc_fpscr_regnum); |
7284e1be UW |
986 | if (ppc_linux_trap_reg_p (gdbarch)) |
987 | { | |
988 | store_register (regcache, tid, PPC_ORIG_R3_REGNUM); | |
989 | store_register (regcache, tid, PPC_TRAP_REGNUM); | |
990 | } | |
9abe5450 EZ |
991 | if (have_ptrace_getvrregs) |
992 | if (tdep->ppc_vr0_regnum != -1 && tdep->ppc_vrsave_regnum != -1) | |
56be3814 | 993 | store_altivec_registers (regcache, tid); |
604c2f83 LM |
994 | if (have_ptrace_getsetvsxregs) |
995 | if (tdep->ppc_vsr0_upper_regnum != -1) | |
996 | store_vsx_registers (regcache, tid); | |
6ced10dd | 997 | if (tdep->ppc_ev0_upper_regnum >= 0) |
56be3814 | 998 | store_spe_register (regcache, tid, -1); |
45229ea4 EZ |
999 | } |
1000 | ||
e0d24f8d WZ |
1001 | static int |
1002 | ppc_linux_check_watch_resources (int type, int cnt, int ot) | |
1003 | { | |
1004 | int tid; | |
1005 | ptid_t ptid = inferior_ptid; | |
1006 | ||
1007 | /* DABR (data address breakpoint register) is optional for PPC variants. | |
1008 | Some variants have one DABR, others have none. So CNT can't be larger | |
1009 | than 1. */ | |
1010 | if (cnt > 1) | |
1011 | return 0; | |
1012 | ||
1013 | /* We need to know whether ptrace supports PTRACE_SET_DEBUGREG and whether | |
1014 | the target has DABR. If either answer is no, the ptrace call will | |
1015 | return -1. Fail in that case. */ | |
1016 | tid = TIDGET (ptid); | |
1017 | if (tid == 0) | |
1018 | tid = PIDGET (ptid); | |
1019 | ||
1020 | if (ptrace (PTRACE_SET_DEBUGREG, tid, 0, 0) == -1) | |
1021 | return 0; | |
1022 | return 1; | |
1023 | } | |
1024 | ||
b7622095 LM |
1025 | /* Fetch the AT_HWCAP entry from the aux vector. */ |
1026 | unsigned long ppc_linux_get_hwcap (void) | |
1027 | { | |
1028 | CORE_ADDR field; | |
1029 | ||
fcb09a75 | 1030 | if (target_auxv_search (¤t_target, AT_HWCAP, &field)) |
b7622095 LM |
1031 | return (unsigned long) field; |
1032 | ||
1033 | return 0; | |
1034 | } | |
1035 | ||
e0d24f8d WZ |
1036 | static int |
1037 | ppc_linux_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) | |
1038 | { | |
1039 | /* Handle sub-8-byte quantities. */ | |
1040 | if (len <= 0) | |
1041 | return 0; | |
1042 | ||
b7622095 LM |
1043 | /* addr+len must fall in the 8 byte watchable region for DABR-based |
1044 | processors. DAC-based processors, like the PowerPC 440, will use | |
1045 | addresses aligned to 4-bytes due to the way the read/write flags are | |
1046 | passed at the moment. */ | |
1047 | if (((ppc_linux_get_hwcap () & PPC_FEATURE_BOOKE) | |
1048 | && (addr + len) > (addr & ~3) + 4) | |
1049 | || (addr + len) > (addr & ~7) + 8) | |
e0d24f8d WZ |
1050 | return 0; |
1051 | ||
1052 | return 1; | |
1053 | } | |
1054 | ||
9f0bdab8 DJ |
1055 | /* The cached DABR value, to install in new threads. */ |
1056 | static long saved_dabr_value; | |
1057 | ||
e0d24f8d | 1058 | /* Set a watchpoint of type TYPE at address ADDR. */ |
2c387241 | 1059 | static int |
e0d24f8d WZ |
1060 | ppc_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw) |
1061 | { | |
9f0bdab8 DJ |
1062 | struct lwp_info *lp; |
1063 | ptid_t ptid; | |
e0d24f8d | 1064 | long dabr_value; |
b7622095 LM |
1065 | long read_mode, write_mode; |
1066 | ||
1067 | if (ppc_linux_get_hwcap () & PPC_FEATURE_BOOKE) | |
1068 | { | |
1069 | /* PowerPC 440 requires only the read/write flags to be passed | |
1070 | to the kernel. */ | |
1071 | read_mode = 1; | |
1072 | write_mode = 2; | |
1073 | } | |
1074 | else | |
1075 | { | |
1076 | /* PowerPC 970 and other DABR-based processors are required to pass | |
1077 | the Breakpoint Translation bit together with the flags. */ | |
1078 | read_mode = 5; | |
1079 | write_mode = 6; | |
1080 | } | |
1081 | ||
1082 | dabr_value = addr & ~(read_mode | write_mode); | |
e0d24f8d WZ |
1083 | switch (rw) |
1084 | { | |
1085 | case hw_read: | |
1086 | /* Set read and translate bits. */ | |
b7622095 | 1087 | dabr_value |= read_mode; |
e0d24f8d WZ |
1088 | break; |
1089 | case hw_write: | |
1090 | /* Set write and translate bits. */ | |
b7622095 | 1091 | dabr_value |= write_mode; |
e0d24f8d WZ |
1092 | break; |
1093 | case hw_access: | |
1094 | /* Set read, write and translate bits. */ | |
b7622095 | 1095 | dabr_value |= read_mode | write_mode; |
e0d24f8d WZ |
1096 | break; |
1097 | } | |
1098 | ||
1c86e440 LM |
1099 | saved_dabr_value = dabr_value; |
1100 | ||
9f0bdab8 DJ |
1101 | ALL_LWPS (lp, ptid) |
1102 | if (ptrace (PTRACE_SET_DEBUGREG, TIDGET (ptid), 0, saved_dabr_value) < 0) | |
1103 | return -1; | |
1c86e440 | 1104 | |
9f0bdab8 | 1105 | return 0; |
e0d24f8d WZ |
1106 | } |
1107 | ||
2c387241 AM |
1108 | static int |
1109 | ppc_linux_remove_watchpoint (CORE_ADDR addr, int len, int rw) | |
e0d24f8d | 1110 | { |
9f0bdab8 DJ |
1111 | struct lwp_info *lp; |
1112 | ptid_t ptid; | |
1113 | long dabr_value = 0; | |
1114 | ||
1115 | saved_dabr_value = 0; | |
1116 | ALL_LWPS (lp, ptid) | |
1117 | if (ptrace (PTRACE_SET_DEBUGREG, TIDGET (ptid), 0, saved_dabr_value) < 0) | |
1118 | return -1; | |
1119 | return 0; | |
e0d24f8d WZ |
1120 | } |
1121 | ||
9f0bdab8 DJ |
1122 | static void |
1123 | ppc_linux_new_thread (ptid_t ptid) | |
e0d24f8d | 1124 | { |
9f0bdab8 | 1125 | ptrace (PTRACE_SET_DEBUGREG, TIDGET (ptid), 0, saved_dabr_value); |
e0d24f8d WZ |
1126 | } |
1127 | ||
1128 | static int | |
9f0bdab8 | 1129 | ppc_linux_stopped_data_address (struct target_ops *target, CORE_ADDR *addr_p) |
e0d24f8d | 1130 | { |
9f0bdab8 | 1131 | struct siginfo *siginfo_p; |
e0d24f8d | 1132 | |
9f0bdab8 | 1133 | siginfo_p = linux_nat_get_siginfo (inferior_ptid); |
e0d24f8d | 1134 | |
9f0bdab8 DJ |
1135 | if (siginfo_p->si_signo != SIGTRAP |
1136 | || (siginfo_p->si_code & 0xffff) != 0x0004 /* TRAP_HWBKPT */) | |
e0d24f8d WZ |
1137 | return 0; |
1138 | ||
407f1a2e | 1139 | *addr_p = (CORE_ADDR) (uintptr_t) siginfo_p->si_addr; |
e0d24f8d WZ |
1140 | return 1; |
1141 | } | |
1142 | ||
9f0bdab8 DJ |
1143 | static int |
1144 | ppc_linux_stopped_by_watchpoint (void) | |
1145 | { | |
1146 | CORE_ADDR addr; | |
1147 | return ppc_linux_stopped_data_address (¤t_target, &addr); | |
1148 | } | |
1149 | ||
5009afc5 AS |
1150 | static int |
1151 | ppc_linux_watchpoint_addr_within_range (struct target_ops *target, | |
1152 | CORE_ADDR addr, | |
1153 | CORE_ADDR start, int length) | |
1154 | { | |
b7622095 LM |
1155 | int mask; |
1156 | ||
1157 | if (ppc_linux_get_hwcap () & PPC_FEATURE_BOOKE) | |
1158 | mask = 3; | |
1159 | else | |
1160 | mask = 7; | |
1161 | ||
1162 | addr &= ~mask; | |
1163 | ||
1164 | /* Check whether [start, start+length-1] intersects [addr, addr+mask]. */ | |
1165 | return start <= addr + mask && start + length - 1 >= addr; | |
5009afc5 AS |
1166 | } |
1167 | ||
10d6c8cd | 1168 | static void |
56be3814 | 1169 | ppc_linux_store_inferior_registers (struct regcache *regcache, int regno) |
45229ea4 | 1170 | { |
05f13b9c EZ |
1171 | /* Overload thread id onto process id */ |
1172 | int tid = TIDGET (inferior_ptid); | |
1173 | ||
1174 | /* No thread id, just use process id */ | |
1175 | if (tid == 0) | |
1176 | tid = PIDGET (inferior_ptid); | |
1177 | ||
45229ea4 | 1178 | if (regno >= 0) |
56be3814 | 1179 | store_register (regcache, tid, regno); |
45229ea4 | 1180 | else |
56be3814 | 1181 | store_ppc_registers (regcache, tid); |
45229ea4 EZ |
1182 | } |
1183 | ||
f2db237a AM |
1184 | /* Functions for transferring registers between a gregset_t or fpregset_t |
1185 | (see sys/ucontext.h) and gdb's regcache. The word size is that used | |
1186 | by the ptrace interface, not the current program's ABI. eg. If a | |
1187 | powerpc64-linux gdb is being used to debug a powerpc32-linux app, we | |
1188 | read or write 64-bit gregsets. This is to suit the host libthread_db. */ | |
1189 | ||
50c9bd31 | 1190 | void |
7f7fe91e | 1191 | supply_gregset (struct regcache *regcache, const gdb_gregset_t *gregsetp) |
c877c8e6 | 1192 | { |
f2db237a | 1193 | const struct regset *regset = ppc_linux_gregset (sizeof (long)); |
f9be684a | 1194 | |
f2db237a | 1195 | ppc_supply_gregset (regset, regcache, -1, gregsetp, sizeof (*gregsetp)); |
c877c8e6 KB |
1196 | } |
1197 | ||
fdb28ac4 | 1198 | void |
7f7fe91e UW |
1199 | fill_gregset (const struct regcache *regcache, |
1200 | gdb_gregset_t *gregsetp, int regno) | |
fdb28ac4 | 1201 | { |
f2db237a | 1202 | const struct regset *regset = ppc_linux_gregset (sizeof (long)); |
f9be684a | 1203 | |
f2db237a AM |
1204 | if (regno == -1) |
1205 | memset (gregsetp, 0, sizeof (*gregsetp)); | |
1206 | ppc_collect_gregset (regset, regcache, regno, gregsetp, sizeof (*gregsetp)); | |
fdb28ac4 KB |
1207 | } |
1208 | ||
50c9bd31 | 1209 | void |
7f7fe91e | 1210 | supply_fpregset (struct regcache *regcache, const gdb_fpregset_t * fpregsetp) |
c877c8e6 | 1211 | { |
f2db237a AM |
1212 | const struct regset *regset = ppc_linux_fpregset (); |
1213 | ||
1214 | ppc_supply_fpregset (regset, regcache, -1, | |
1215 | fpregsetp, sizeof (*fpregsetp)); | |
c877c8e6 | 1216 | } |
fdb28ac4 | 1217 | |
fdb28ac4 | 1218 | void |
7f7fe91e UW |
1219 | fill_fpregset (const struct regcache *regcache, |
1220 | gdb_fpregset_t *fpregsetp, int regno) | |
fdb28ac4 | 1221 | { |
f2db237a AM |
1222 | const struct regset *regset = ppc_linux_fpregset (); |
1223 | ||
1224 | ppc_collect_fpregset (regset, regcache, regno, | |
1225 | fpregsetp, sizeof (*fpregsetp)); | |
fdb28ac4 | 1226 | } |
10d6c8cd | 1227 | |
310a98e1 DJ |
1228 | static const struct target_desc * |
1229 | ppc_linux_read_description (struct target_ops *ops) | |
1230 | { | |
7284e1be | 1231 | int altivec = 0; |
604c2f83 | 1232 | int vsx = 0; |
7284e1be UW |
1233 | |
1234 | int tid = TIDGET (inferior_ptid); | |
1235 | if (tid == 0) | |
1236 | tid = PIDGET (inferior_ptid); | |
1237 | ||
310a98e1 DJ |
1238 | if (have_ptrace_getsetevrregs) |
1239 | { | |
1240 | struct gdb_evrregset_t evrregset; | |
310a98e1 DJ |
1241 | |
1242 | if (ptrace (PTRACE_GETEVRREGS, tid, 0, &evrregset) >= 0) | |
7284e1be UW |
1243 | return tdesc_powerpc_e500l; |
1244 | ||
1245 | /* EIO means that the PTRACE_GETEVRREGS request isn't supported. | |
1246 | Anything else needs to be reported. */ | |
1247 | else if (errno != EIO) | |
1248 | perror_with_name (_("Unable to fetch SPE registers")); | |
1249 | } | |
1250 | ||
604c2f83 LM |
1251 | if (have_ptrace_getsetvsxregs) |
1252 | { | |
1253 | gdb_vsxregset_t vsxregset; | |
1254 | ||
1255 | if (ptrace (PTRACE_GETVSXREGS, tid, 0, &vsxregset) >= 0) | |
1256 | vsx = 1; | |
1257 | ||
1258 | /* EIO means that the PTRACE_GETVSXREGS request isn't supported. | |
1259 | Anything else needs to be reported. */ | |
1260 | else if (errno != EIO) | |
1261 | perror_with_name (_("Unable to fetch VSX registers")); | |
1262 | } | |
1263 | ||
7284e1be UW |
1264 | if (have_ptrace_getvrregs) |
1265 | { | |
1266 | gdb_vrregset_t vrregset; | |
1267 | ||
1268 | if (ptrace (PTRACE_GETVRREGS, tid, 0, &vrregset) >= 0) | |
1269 | altivec = 1; | |
1270 | ||
1271 | /* EIO means that the PTRACE_GETVRREGS request isn't supported. | |
1272 | Anything else needs to be reported. */ | |
1273 | else if (errno != EIO) | |
1274 | perror_with_name (_("Unable to fetch AltiVec registers")); | |
310a98e1 DJ |
1275 | } |
1276 | ||
7284e1be UW |
1277 | /* Check for 64-bit inferior process. This is the case when the host is |
1278 | 64-bit, and in addition the top bit of the MSR register is set. */ | |
1279 | #ifdef __powerpc64__ | |
1280 | { | |
1281 | long msr; | |
1282 | errno = 0; | |
1283 | msr = (long) ptrace (PTRACE_PEEKUSER, tid, PT_MSR * 8, 0); | |
1284 | if (errno == 0 && msr < 0) | |
604c2f83 LM |
1285 | { |
1286 | if (vsx) | |
1287 | return tdesc_powerpc_vsx64l; | |
1288 | else if (altivec) | |
1289 | return tdesc_powerpc_altivec64l; | |
1290 | ||
1291 | return tdesc_powerpc_64l; | |
1292 | } | |
7284e1be UW |
1293 | } |
1294 | #endif | |
1295 | ||
604c2f83 LM |
1296 | if (vsx) |
1297 | return tdesc_powerpc_vsx32l; | |
1298 | else if (altivec) | |
1299 | return tdesc_powerpc_altivec32l; | |
1300 | ||
1301 | return tdesc_powerpc_32l; | |
310a98e1 DJ |
1302 | } |
1303 | ||
10d6c8cd DJ |
1304 | void _initialize_ppc_linux_nat (void); |
1305 | ||
1306 | void | |
1307 | _initialize_ppc_linux_nat (void) | |
1308 | { | |
1309 | struct target_ops *t; | |
1310 | ||
1311 | /* Fill in the generic GNU/Linux methods. */ | |
1312 | t = linux_target (); | |
1313 | ||
1314 | /* Add our register access methods. */ | |
1315 | t->to_fetch_registers = ppc_linux_fetch_inferior_registers; | |
1316 | t->to_store_registers = ppc_linux_store_inferior_registers; | |
1317 | ||
e0d24f8d WZ |
1318 | /* Add our watchpoint methods. */ |
1319 | t->to_can_use_hw_breakpoint = ppc_linux_check_watch_resources; | |
1320 | t->to_region_ok_for_hw_watchpoint = ppc_linux_region_ok_for_hw_watchpoint; | |
1321 | t->to_insert_watchpoint = ppc_linux_insert_watchpoint; | |
1322 | t->to_remove_watchpoint = ppc_linux_remove_watchpoint; | |
1323 | t->to_stopped_by_watchpoint = ppc_linux_stopped_by_watchpoint; | |
1324 | t->to_stopped_data_address = ppc_linux_stopped_data_address; | |
5009afc5 | 1325 | t->to_watchpoint_addr_within_range = ppc_linux_watchpoint_addr_within_range; |
e0d24f8d | 1326 | |
310a98e1 DJ |
1327 | t->to_read_description = ppc_linux_read_description; |
1328 | ||
10d6c8cd | 1329 | /* Register the target. */ |
f973ed9c | 1330 | linux_nat_add_target (t); |
9f0bdab8 | 1331 | linux_nat_set_new_thread (t, ppc_linux_new_thread); |
10d6c8cd | 1332 | } |