2011-02-26 Michael Snyder <msnyder@vmware.com>
[deliverable/binutils-gdb.git] / gdb / ppc-linux-tdep.c
CommitLineData
c877c8e6 1/* Target-dependent code for GDB, the GNU debugger.
4e052eda 2
6aba47ca 3 Copyright (C) 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
7b6bb8da 4 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
76a9d10f 5 Free Software Foundation, Inc.
c877c8e6
KB
6
7 This file is part of GDB.
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
a9762ec7 11 the Free Software Foundation; either version 3 of the License, or
c877c8e6
KB
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
a9762ec7 20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
c877c8e6
KB
21
22#include "defs.h"
23#include "frame.h"
24#include "inferior.h"
25#include "symtab.h"
26#include "target.h"
27#include "gdbcore.h"
28#include "gdbcmd.h"
29#include "symfile.h"
30#include "objfiles.h"
4e052eda 31#include "regcache.h"
fd0407d6 32#include "value.h"
4be87837 33#include "osabi.h"
f9be684a 34#include "regset.h"
6ded7999 35#include "solib-svr4.h"
85e747d2 36#include "solib-spu.h"
cc5f0d61
UW
37#include "solib.h"
38#include "solist.h"
9aa1e687 39#include "ppc-tdep.h"
7284e1be 40#include "ppc-linux-tdep.h"
61a65099
KB
41#include "trad-frame.h"
42#include "frame-unwind.h"
a8f60bfc 43#include "tramp-frame.h"
85e747d2
UW
44#include "observer.h"
45#include "auxv.h"
46#include "elf/common.h"
cc5f0d61
UW
47#include "exceptions.h"
48#include "arch-utils.h"
49#include "spu-tdep.h"
a96d9b2e 50#include "xml-syscall.h"
a5ee0f0c 51#include "linux-tdep.h"
9aa1e687 52
7284e1be
UW
53#include "features/rs6000/powerpc-32l.c"
54#include "features/rs6000/powerpc-altivec32l.c"
f4d9bade 55#include "features/rs6000/powerpc-cell32l.c"
604c2f83 56#include "features/rs6000/powerpc-vsx32l.c"
69abc51c
TJB
57#include "features/rs6000/powerpc-isa205-32l.c"
58#include "features/rs6000/powerpc-isa205-altivec32l.c"
59#include "features/rs6000/powerpc-isa205-vsx32l.c"
7284e1be
UW
60#include "features/rs6000/powerpc-64l.c"
61#include "features/rs6000/powerpc-altivec64l.c"
f4d9bade 62#include "features/rs6000/powerpc-cell64l.c"
604c2f83 63#include "features/rs6000/powerpc-vsx64l.c"
69abc51c
TJB
64#include "features/rs6000/powerpc-isa205-64l.c"
65#include "features/rs6000/powerpc-isa205-altivec64l.c"
66#include "features/rs6000/powerpc-isa205-vsx64l.c"
7284e1be
UW
67#include "features/rs6000/powerpc-e500l.c"
68
a96d9b2e
SDJ
69/* The syscall's XML filename for PPC and PPC64. */
70#define XML_SYSCALL_FILENAME_PPC "syscalls/ppc-linux.xml"
71#define XML_SYSCALL_FILENAME_PPC64 "syscalls/ppc64-linux.xml"
c877c8e6 72
122a33de
KB
73/* ppc_linux_memory_remove_breakpoints attempts to remove a breakpoint
74 in much the same fashion as memory_remove_breakpoint in mem-break.c,
75 but is careful not to write back the previous contents if the code
76 in question has changed in between inserting the breakpoint and
77 removing it.
78
79 Here is the problem that we're trying to solve...
80
81 Once upon a time, before introducing this function to remove
82 breakpoints from the inferior, setting a breakpoint on a shared
83 library function prior to running the program would not work
84 properly. In order to understand the problem, it is first
85 necessary to understand a little bit about dynamic linking on
86 this platform.
87
88 A call to a shared library function is accomplished via a bl
89 (branch-and-link) instruction whose branch target is an entry
90 in the procedure linkage table (PLT). The PLT in the object
91 file is uninitialized. To gdb, prior to running the program, the
92 entries in the PLT are all zeros.
93
94 Once the program starts running, the shared libraries are loaded
95 and the procedure linkage table is initialized, but the entries in
96 the table are not (necessarily) resolved. Once a function is
97 actually called, the code in the PLT is hit and the function is
98 resolved. In order to better illustrate this, an example is in
99 order; the following example is from the gdb testsuite.
100
101 We start the program shmain.
102
103 [kev@arroyo testsuite]$ ../gdb gdb.base/shmain
104 [...]
105
106 We place two breakpoints, one on shr1 and the other on main.
107
108 (gdb) b shr1
109 Breakpoint 1 at 0x100409d4
110 (gdb) b main
111 Breakpoint 2 at 0x100006a0: file gdb.base/shmain.c, line 44.
112
113 Examine the instruction (and the immediatly following instruction)
114 upon which the breakpoint was placed. Note that the PLT entry
115 for shr1 contains zeros.
116
117 (gdb) x/2i 0x100409d4
118 0x100409d4 <shr1>: .long 0x0
119 0x100409d8 <shr1+4>: .long 0x0
120
121 Now run 'til main.
122
123 (gdb) r
124 Starting program: gdb.base/shmain
125 Breakpoint 1 at 0xffaf790: file gdb.base/shr1.c, line 19.
126
127 Breakpoint 2, main ()
128 at gdb.base/shmain.c:44
129 44 g = 1;
130
131 Examine the PLT again. Note that the loading of the shared
132 library has initialized the PLT to code which loads a constant
133 (which I think is an index into the GOT) into r11 and then
134 branchs a short distance to the code which actually does the
135 resolving.
136
137 (gdb) x/2i 0x100409d4
138 0x100409d4 <shr1>: li r11,4
139 0x100409d8 <shr1+4>: b 0x10040984 <sg+4>
140 (gdb) c
141 Continuing.
142
143 Breakpoint 1, shr1 (x=1)
144 at gdb.base/shr1.c:19
145 19 l = 1;
146
147 Now we've hit the breakpoint at shr1. (The breakpoint was
148 reset from the PLT entry to the actual shr1 function after the
149 shared library was loaded.) Note that the PLT entry has been
0df8b418 150 resolved to contain a branch that takes us directly to shr1.
122a33de
KB
151 (The real one, not the PLT entry.)
152
153 (gdb) x/2i 0x100409d4
154 0x100409d4 <shr1>: b 0xffaf76c <shr1>
155 0x100409d8 <shr1+4>: b 0x10040984 <sg+4>
156
157 The thing to note here is that the PLT entry for shr1 has been
158 changed twice.
159
160 Now the problem should be obvious. GDB places a breakpoint (a
0df8b418 161 trap instruction) on the zero value of the PLT entry for shr1.
122a33de
KB
162 Later on, after the shared library had been loaded and the PLT
163 initialized, GDB gets a signal indicating this fact and attempts
164 (as it always does when it stops) to remove all the breakpoints.
165
166 The breakpoint removal was causing the former contents (a zero
167 word) to be written back to the now initialized PLT entry thus
168 destroying a portion of the initialization that had occurred only a
169 short time ago. When execution continued, the zero word would be
170 executed as an instruction an an illegal instruction trap was
171 generated instead. (0 is not a legal instruction.)
172
173 The fix for this problem was fairly straightforward. The function
174 memory_remove_breakpoint from mem-break.c was copied to this file,
175 modified slightly, and renamed to ppc_linux_memory_remove_breakpoint.
176 In tm-linux.h, MEMORY_REMOVE_BREAKPOINT is defined to call this new
177 function.
178
179 The differences between ppc_linux_memory_remove_breakpoint () and
180 memory_remove_breakpoint () are minor. All that the former does
181 that the latter does not is check to make sure that the breakpoint
182 location actually contains a breakpoint (trap instruction) prior
183 to attempting to write back the old contents. If it does contain
0df8b418 184 a trap instruction, we allow the old contents to be written back.
122a33de
KB
185 Otherwise, we silently do nothing.
186
187 The big question is whether memory_remove_breakpoint () should be
188 changed to have the same functionality. The downside is that more
189 traffic is generated for remote targets since we'll have an extra
190 fetch of a memory word each time a breakpoint is removed.
191
192 For the time being, we'll leave this self-modifying-code-friendly
193 version in ppc-linux-tdep.c, but it ought to be migrated somewhere
194 else in the event that some other platform has similar needs with
195 regard to removing breakpoints in some potentially self modifying
196 code. */
63807e1d 197static int
ae4b2284
MD
198ppc_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
199 struct bp_target_info *bp_tgt)
482ca3f5 200{
8181d85f 201 CORE_ADDR addr = bp_tgt->placed_address;
f4f9705a 202 const unsigned char *bp;
482ca3f5
KB
203 int val;
204 int bplen;
50fd1280 205 gdb_byte old_contents[BREAKPOINT_MAX];
8defab1a 206 struct cleanup *cleanup;
482ca3f5
KB
207
208 /* Determine appropriate breakpoint contents and size for this address. */
ae4b2284 209 bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen);
482ca3f5 210 if (bp == NULL)
8a3fe4f8 211 error (_("Software breakpoints not implemented for this target."));
482ca3f5 212
8defab1a
DJ
213 /* Make sure we see the memory breakpoints. */
214 cleanup = make_show_memory_breakpoints_cleanup (1);
482ca3f5
KB
215 val = target_read_memory (addr, old_contents, bplen);
216
217 /* If our breakpoint is no longer at the address, this means that the
218 program modified the code on us, so it is wrong to put back the
0df8b418 219 old value. */
482ca3f5 220 if (val == 0 && memcmp (bp, old_contents, bplen) == 0)
8181d85f 221 val = target_write_memory (addr, bp_tgt->shadow_contents, bplen);
482ca3f5 222
8defab1a 223 do_cleanups (cleanup);
482ca3f5
KB
224 return val;
225}
6ded7999 226
b9ff3018
AC
227/* For historic reasons, PPC 32 GNU/Linux follows PowerOpen rather
228 than the 32 bit SYSV R4 ABI structure return convention - all
229 structures, no matter their size, are put in memory. Vectors,
230 which were added later, do get returned in a register though. */
231
05580c65 232static enum return_value_convention
c055b101
CV
233ppc_linux_return_value (struct gdbarch *gdbarch, struct type *func_type,
234 struct type *valtype, struct regcache *regcache,
235 gdb_byte *readbuf, const gdb_byte *writebuf)
b9ff3018 236{
05580c65
AC
237 if ((TYPE_CODE (valtype) == TYPE_CODE_STRUCT
238 || TYPE_CODE (valtype) == TYPE_CODE_UNION)
239 && !((TYPE_LENGTH (valtype) == 16 || TYPE_LENGTH (valtype) == 8)
240 && TYPE_VECTOR (valtype)))
241 return RETURN_VALUE_STRUCT_CONVENTION;
242 else
c055b101
CV
243 return ppc_sysv_abi_return_value (gdbarch, func_type, valtype, regcache,
244 readbuf, writebuf);
b9ff3018
AC
245}
246
f470a70a
JB
247/* Macros for matching instructions. Note that, since all the
248 operands are masked off before they're or-ed into the instruction,
249 you can use -1 to make masks. */
250
251#define insn_d(opcd, rts, ra, d) \
252 ((((opcd) & 0x3f) << 26) \
253 | (((rts) & 0x1f) << 21) \
254 | (((ra) & 0x1f) << 16) \
255 | ((d) & 0xffff))
256
257#define insn_ds(opcd, rts, ra, d, xo) \
258 ((((opcd) & 0x3f) << 26) \
259 | (((rts) & 0x1f) << 21) \
260 | (((ra) & 0x1f) << 16) \
261 | ((d) & 0xfffc) \
262 | ((xo) & 0x3))
263
264#define insn_xfx(opcd, rts, spr, xo) \
265 ((((opcd) & 0x3f) << 26) \
266 | (((rts) & 0x1f) << 21) \
267 | (((spr) & 0x1f) << 16) \
268 | (((spr) & 0x3e0) << 6) \
269 | (((xo) & 0x3ff) << 1))
270
271/* Read a PPC instruction from memory. PPC instructions are always
272 big-endian, no matter what endianness the program is running in, so
273 we can't use read_memory_integer or one of its friends here. */
274static unsigned int
275read_insn (CORE_ADDR pc)
276{
277 unsigned char buf[4];
278
279 read_memory (pc, buf, 4);
280 return (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3];
281}
282
283
284/* An instruction to match. */
285struct insn_pattern
286{
0df8b418
MS
287 unsigned int mask; /* mask the insn with this... */
288 unsigned int data; /* ...and see if it matches this. */
f470a70a
JB
289 int optional; /* If non-zero, this insn may be absent. */
290};
291
292/* Return non-zero if the instructions at PC match the series
293 described in PATTERN, or zero otherwise. PATTERN is an array of
294 'struct insn_pattern' objects, terminated by an entry whose mask is
295 zero.
296
297 When the match is successful, fill INSN[i] with what PATTERN[i]
298 matched. If PATTERN[i] is optional, and the instruction wasn't
299 present, set INSN[i] to 0 (which is not a valid PPC instruction).
300 INSN should have as many elements as PATTERN. Note that, if
301 PATTERN contains optional instructions which aren't present in
302 memory, then INSN will have holes, so INSN[i] isn't necessarily the
303 i'th instruction in memory. */
304static int
305insns_match_pattern (CORE_ADDR pc,
306 struct insn_pattern *pattern,
307 unsigned int *insn)
308{
309 int i;
310
311 for (i = 0; pattern[i].mask; i++)
312 {
313 insn[i] = read_insn (pc);
314 if ((insn[i] & pattern[i].mask) == pattern[i].data)
315 pc += 4;
316 else if (pattern[i].optional)
317 insn[i] = 0;
318 else
319 return 0;
320 }
321
322 return 1;
323}
324
325
326/* Return the 'd' field of the d-form instruction INSN, properly
327 sign-extended. */
328static CORE_ADDR
329insn_d_field (unsigned int insn)
330{
331 return ((((CORE_ADDR) insn & 0xffff) ^ 0x8000) - 0x8000);
332}
333
334
335/* Return the 'ds' field of the ds-form instruction INSN, with the two
336 zero bits concatenated at the right, and properly
337 sign-extended. */
338static CORE_ADDR
339insn_ds_field (unsigned int insn)
340{
341 return ((((CORE_ADDR) insn & 0xfffc) ^ 0x8000) - 0x8000);
342}
343
344
e538d2d7 345/* If DESC is the address of a 64-bit PowerPC GNU/Linux function
d64558a5
JB
346 descriptor, return the descriptor's entry point. */
347static CORE_ADDR
e17a4113 348ppc64_desc_entry_point (struct gdbarch *gdbarch, CORE_ADDR desc)
d64558a5 349{
e17a4113 350 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
d64558a5 351 /* The first word of the descriptor is the entry point. */
e17a4113 352 return (CORE_ADDR) read_memory_unsigned_integer (desc, 8, byte_order);
d64558a5
JB
353}
354
355
f470a70a
JB
356/* Pattern for the standard linkage function. These are built by
357 build_plt_stub in elf64-ppc.c, whose GLINK argument is always
358 zero. */
42848c96 359static struct insn_pattern ppc64_standard_linkage1[] =
f470a70a
JB
360 {
361 /* addis r12, r2, <any> */
362 { insn_d (-1, -1, -1, 0), insn_d (15, 12, 2, 0), 0 },
363
364 /* std r2, 40(r1) */
365 { -1, insn_ds (62, 2, 1, 40, 0), 0 },
366
367 /* ld r11, <any>(r12) */
368 { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 12, 0, 0), 0 },
369
370 /* addis r12, r12, 1 <optional> */
42848c96 371 { insn_d (-1, -1, -1, -1), insn_d (15, 12, 12, 1), 1 },
f470a70a
JB
372
373 /* ld r2, <any>(r12) */
374 { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 2, 12, 0, 0), 0 },
375
376 /* addis r12, r12, 1 <optional> */
42848c96 377 { insn_d (-1, -1, -1, -1), insn_d (15, 12, 12, 1), 1 },
f470a70a
JB
378
379 /* mtctr r11 */
42848c96 380 { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 11, 9, 467), 0 },
f470a70a
JB
381
382 /* ld r11, <any>(r12) */
383 { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 12, 0, 0), 0 },
384
385 /* bctr */
386 { -1, 0x4e800420, 0 },
387
388 { 0, 0, 0 }
389 };
42848c96
UW
390#define PPC64_STANDARD_LINKAGE1_LEN \
391 (sizeof (ppc64_standard_linkage1) / sizeof (ppc64_standard_linkage1[0]))
392
393static struct insn_pattern ppc64_standard_linkage2[] =
394 {
395 /* addis r12, r2, <any> */
396 { insn_d (-1, -1, -1, 0), insn_d (15, 12, 2, 0), 0 },
397
398 /* std r2, 40(r1) */
399 { -1, insn_ds (62, 2, 1, 40, 0), 0 },
400
401 /* ld r11, <any>(r12) */
402 { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 12, 0, 0), 0 },
403
404 /* addi r12, r12, <any> <optional> */
405 { insn_d (-1, -1, -1, 0), insn_d (14, 12, 12, 0), 1 },
406
407 /* mtctr r11 */
408 { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 11, 9, 467), 0 },
409
410 /* ld r2, <any>(r12) */
411 { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 2, 12, 0, 0), 0 },
412
413 /* ld r11, <any>(r12) */
414 { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 12, 0, 0), 0 },
415
416 /* bctr */
417 { -1, 0x4e800420, 0 },
418
419 { 0, 0, 0 }
420 };
421#define PPC64_STANDARD_LINKAGE2_LEN \
422 (sizeof (ppc64_standard_linkage2) / sizeof (ppc64_standard_linkage2[0]))
423
424static struct insn_pattern ppc64_standard_linkage3[] =
425 {
426 /* std r2, 40(r1) */
427 { -1, insn_ds (62, 2, 1, 40, 0), 0 },
428
429 /* ld r11, <any>(r2) */
430 { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 2, 0, 0), 0 },
431
432 /* addi r2, r2, <any> <optional> */
433 { insn_d (-1, -1, -1, 0), insn_d (14, 2, 2, 0), 1 },
434
435 /* mtctr r11 */
436 { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 11, 9, 467), 0 },
437
438 /* ld r11, <any>(r2) */
439 { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 2, 0, 0), 0 },
440
441 /* ld r2, <any>(r2) */
442 { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 2, 2, 0, 0), 0 },
443
444 /* bctr */
445 { -1, 0x4e800420, 0 },
446
447 { 0, 0, 0 }
448 };
449#define PPC64_STANDARD_LINKAGE3_LEN \
450 (sizeof (ppc64_standard_linkage3) / sizeof (ppc64_standard_linkage3[0]))
451
f470a70a 452
f470a70a
JB
453/* When the dynamic linker is doing lazy symbol resolution, the first
454 call to a function in another object will go like this:
455
456 - The user's function calls the linkage function:
457
458 100007c4: 4b ff fc d5 bl 10000498
459 100007c8: e8 41 00 28 ld r2,40(r1)
460
461 - The linkage function loads the entry point (and other stuff) from
462 the function descriptor in the PLT, and jumps to it:
463
464 10000498: 3d 82 00 00 addis r12,r2,0
465 1000049c: f8 41 00 28 std r2,40(r1)
466 100004a0: e9 6c 80 98 ld r11,-32616(r12)
467 100004a4: e8 4c 80 a0 ld r2,-32608(r12)
468 100004a8: 7d 69 03 a6 mtctr r11
469 100004ac: e9 6c 80 a8 ld r11,-32600(r12)
470 100004b0: 4e 80 04 20 bctr
471
472 - But since this is the first time that PLT entry has been used, it
473 sends control to its glink entry. That loads the number of the
474 PLT entry and jumps to the common glink0 code:
475
476 10000c98: 38 00 00 00 li r0,0
477 10000c9c: 4b ff ff dc b 10000c78
478
479 - The common glink0 code then transfers control to the dynamic
480 linker's fixup code:
481
482 10000c78: e8 41 00 28 ld r2,40(r1)
483 10000c7c: 3d 82 00 00 addis r12,r2,0
484 10000c80: e9 6c 80 80 ld r11,-32640(r12)
485 10000c84: e8 4c 80 88 ld r2,-32632(r12)
486 10000c88: 7d 69 03 a6 mtctr r11
487 10000c8c: e9 6c 80 90 ld r11,-32624(r12)
488 10000c90: 4e 80 04 20 bctr
489
490 Eventually, this code will figure out how to skip all of this,
491 including the dynamic linker. At the moment, we just get through
492 the linkage function. */
493
494/* If the current thread is about to execute a series of instructions
495 at PC matching the ppc64_standard_linkage pattern, and INSN is the result
496 from that pattern match, return the code address to which the
497 standard linkage function will send them. (This doesn't deal with
498 dynamic linker lazy symbol resolution stubs.) */
499static CORE_ADDR
42848c96
UW
500ppc64_standard_linkage1_target (struct frame_info *frame,
501 CORE_ADDR pc, unsigned int *insn)
f470a70a 502{
e17a4113
UW
503 struct gdbarch *gdbarch = get_frame_arch (frame);
504 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
f470a70a
JB
505
506 /* The address of the function descriptor this linkage function
507 references. */
508 CORE_ADDR desc
52f729a7
UW
509 = ((CORE_ADDR) get_frame_register_unsigned (frame,
510 tdep->ppc_gp0_regnum + 2)
f470a70a
JB
511 + (insn_d_field (insn[0]) << 16)
512 + insn_ds_field (insn[2]));
513
514 /* The first word of the descriptor is the entry point. Return that. */
e17a4113 515 return ppc64_desc_entry_point (gdbarch, desc);
f470a70a
JB
516}
517
6207416c 518static struct core_regset_section ppc_linux_vsx_regset_sections[] =
17ea7499 519{
2f2241f1 520 { ".reg", 48 * 4, "general-purpose" },
1b1818e4
UW
521 { ".reg2", 264, "floating-point" },
522 { ".reg-ppc-vmx", 544, "ppc Altivec" },
523 { ".reg-ppc-vsx", 256, "POWER7 VSX" },
17ea7499
CES
524 { NULL, 0}
525};
526
6207416c
LM
527static struct core_regset_section ppc_linux_vmx_regset_sections[] =
528{
2f2241f1 529 { ".reg", 48 * 4, "general-purpose" },
1b1818e4
UW
530 { ".reg2", 264, "floating-point" },
531 { ".reg-ppc-vmx", 544, "ppc Altivec" },
6207416c
LM
532 { NULL, 0}
533};
534
535static struct core_regset_section ppc_linux_fp_regset_sections[] =
536{
2f2241f1
UW
537 { ".reg", 48 * 4, "general-purpose" },
538 { ".reg2", 264, "floating-point" },
539 { NULL, 0}
540};
541
542static struct core_regset_section ppc64_linux_vsx_regset_sections[] =
543{
544 { ".reg", 48 * 8, "general-purpose" },
545 { ".reg2", 264, "floating-point" },
546 { ".reg-ppc-vmx", 544, "ppc Altivec" },
547 { ".reg-ppc-vsx", 256, "POWER7 VSX" },
548 { NULL, 0}
549};
550
551static struct core_regset_section ppc64_linux_vmx_regset_sections[] =
552{
553 { ".reg", 48 * 8, "general-purpose" },
554 { ".reg2", 264, "floating-point" },
555 { ".reg-ppc-vmx", 544, "ppc Altivec" },
556 { NULL, 0}
557};
558
559static struct core_regset_section ppc64_linux_fp_regset_sections[] =
560{
561 { ".reg", 48 * 8, "general-purpose" },
1b1818e4 562 { ".reg2", 264, "floating-point" },
6207416c
LM
563 { NULL, 0}
564};
565
42848c96
UW
566static CORE_ADDR
567ppc64_standard_linkage2_target (struct frame_info *frame,
568 CORE_ADDR pc, unsigned int *insn)
569{
e17a4113
UW
570 struct gdbarch *gdbarch = get_frame_arch (frame);
571 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
42848c96
UW
572
573 /* The address of the function descriptor this linkage function
574 references. */
575 CORE_ADDR desc
576 = ((CORE_ADDR) get_frame_register_unsigned (frame,
577 tdep->ppc_gp0_regnum + 2)
578 + (insn_d_field (insn[0]) << 16)
579 + insn_ds_field (insn[2]));
580
581 /* The first word of the descriptor is the entry point. Return that. */
e17a4113 582 return ppc64_desc_entry_point (gdbarch, desc);
42848c96
UW
583}
584
585static CORE_ADDR
586ppc64_standard_linkage3_target (struct frame_info *frame,
587 CORE_ADDR pc, unsigned int *insn)
588{
e17a4113
UW
589 struct gdbarch *gdbarch = get_frame_arch (frame);
590 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
42848c96
UW
591
592 /* The address of the function descriptor this linkage function
593 references. */
594 CORE_ADDR desc
595 = ((CORE_ADDR) get_frame_register_unsigned (frame,
596 tdep->ppc_gp0_regnum + 2)
597 + insn_ds_field (insn[1]));
598
599 /* The first word of the descriptor is the entry point. Return that. */
e17a4113 600 return ppc64_desc_entry_point (gdbarch, desc);
42848c96
UW
601}
602
f470a70a
JB
603
604/* Given that we've begun executing a call trampoline at PC, return
605 the entry point of the function the trampoline will go to. */
606static CORE_ADDR
52f729a7 607ppc64_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc)
f470a70a 608{
42848c96
UW
609 unsigned int ppc64_standard_linkage1_insn[PPC64_STANDARD_LINKAGE1_LEN];
610 unsigned int ppc64_standard_linkage2_insn[PPC64_STANDARD_LINKAGE2_LEN];
611 unsigned int ppc64_standard_linkage3_insn[PPC64_STANDARD_LINKAGE3_LEN];
612 CORE_ADDR target;
613
614 if (insns_match_pattern (pc, ppc64_standard_linkage1,
615 ppc64_standard_linkage1_insn))
616 pc = ppc64_standard_linkage1_target (frame, pc,
617 ppc64_standard_linkage1_insn);
618 else if (insns_match_pattern (pc, ppc64_standard_linkage2,
619 ppc64_standard_linkage2_insn))
620 pc = ppc64_standard_linkage2_target (frame, pc,
621 ppc64_standard_linkage2_insn);
622 else if (insns_match_pattern (pc, ppc64_standard_linkage3,
623 ppc64_standard_linkage3_insn))
624 pc = ppc64_standard_linkage3_target (frame, pc,
625 ppc64_standard_linkage3_insn);
f470a70a
JB
626 else
627 return 0;
42848c96
UW
628
629 /* The PLT descriptor will either point to the already resolved target
630 address, or else to a glink stub. As the latter carry synthetic @plt
631 symbols, find_solib_trampoline_target should be able to resolve them. */
632 target = find_solib_trampoline_target (frame, pc);
633 return target? target : pc;
f470a70a
JB
634}
635
636
00d5f93a 637/* Support for convert_from_func_ptr_addr (ARCH, ADDR, TARG) on PPC64
e2d0e7eb 638 GNU/Linux.
02631ec0
JB
639
640 Usually a function pointer's representation is simply the address
2bbe3cc1
DJ
641 of the function. On GNU/Linux on the PowerPC however, a function
642 pointer may be a pointer to a function descriptor.
643
644 For PPC64, a function descriptor is a TOC entry, in a data section,
645 which contains three words: the first word is the address of the
646 function, the second word is the TOC pointer (r2), and the third word
647 is the static chain value.
648
2bbe3cc1
DJ
649 Throughout GDB it is currently assumed that a function pointer contains
650 the address of the function, which is not easy to fix. In addition, the
e538d2d7
JB
651 conversion of a function address to a function pointer would
652 require allocation of a TOC entry in the inferior's memory space,
653 with all its drawbacks. To be able to call C++ virtual methods in
654 the inferior (which are called via function pointers),
655 find_function_addr uses this function to get the function address
2bbe3cc1 656 from a function pointer.
02631ec0 657
2bbe3cc1
DJ
658 If ADDR points at what is clearly a function descriptor, transform
659 it into the address of the corresponding function, if needed. Be
660 conservative, otherwise GDB will do the transformation on any
661 random addresses such as occur when there is no symbol table. */
02631ec0
JB
662
663static CORE_ADDR
00d5f93a
UW
664ppc64_linux_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
665 CORE_ADDR addr,
666 struct target_ops *targ)
02631ec0 667{
e17a4113 668 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
0542c86d 669 struct target_section *s = target_section_by_addr (targ, addr);
02631ec0 670
9b540880 671 /* Check if ADDR points to a function descriptor. */
00d5f93a 672 if (s && strcmp (s->the_bfd_section->name, ".opd") == 0)
e84ee240
UW
673 {
674 /* There may be relocations that need to be applied to the .opd
675 section. Unfortunately, this function may be called at a time
676 where these relocations have not yet been performed -- this can
677 happen for example shortly after a library has been loaded with
678 dlopen, but ld.so has not yet applied the relocations.
679
680 To cope with both the case where the relocation has been applied,
681 and the case where it has not yet been applied, we do *not* read
682 the (maybe) relocated value from target memory, but we instead
683 read the non-relocated value from the BFD, and apply the relocation
684 offset manually.
685
686 This makes the assumption that all .opd entries are always relocated
687 by the same offset the section itself was relocated. This should
688 always be the case for GNU/Linux executables and shared libraries.
689 Note that other kind of object files (e.g. those added via
690 add-symbol-files) will currently never end up here anyway, as this
691 function accesses *target* sections only; only the main exec and
692 shared libraries are ever added to the target. */
693
694 gdb_byte buf[8];
695 int res;
696
697 res = bfd_get_section_contents (s->bfd, s->the_bfd_section,
698 &buf, addr - s->addr, 8);
699 if (res != 0)
e17a4113 700 return extract_unsigned_integer (buf, 8, byte_order)
e84ee240
UW
701 - bfd_section_vma (s->bfd, s->the_bfd_section) + s->addr;
702 }
9b540880
AC
703
704 return addr;
02631ec0
JB
705}
706
7284e1be
UW
707/* Wrappers to handle Linux-only registers. */
708
709static void
710ppc_linux_supply_gregset (const struct regset *regset,
711 struct regcache *regcache,
712 int regnum, const void *gregs, size_t len)
713{
714 const struct ppc_reg_offsets *offsets = regset->descr;
715
716 ppc_supply_gregset (regset, regcache, regnum, gregs, len);
717
718 if (ppc_linux_trap_reg_p (get_regcache_arch (regcache)))
719 {
720 /* "orig_r3" is stored 2 slots after "pc". */
721 if (regnum == -1 || regnum == PPC_ORIG_R3_REGNUM)
722 ppc_supply_reg (regcache, PPC_ORIG_R3_REGNUM, gregs,
723 offsets->pc_offset + 2 * offsets->gpr_size,
724 offsets->gpr_size);
725
726 /* "trap" is stored 8 slots after "pc". */
727 if (regnum == -1 || regnum == PPC_TRAP_REGNUM)
728 ppc_supply_reg (regcache, PPC_TRAP_REGNUM, gregs,
729 offsets->pc_offset + 8 * offsets->gpr_size,
730 offsets->gpr_size);
731 }
732}
f2db237a 733
f9be684a 734static void
f2db237a
AM
735ppc_linux_collect_gregset (const struct regset *regset,
736 const struct regcache *regcache,
737 int regnum, void *gregs, size_t len)
f9be684a 738{
7284e1be
UW
739 const struct ppc_reg_offsets *offsets = regset->descr;
740
741 /* Clear areas in the linux gregset not written elsewhere. */
f2db237a
AM
742 if (regnum == -1)
743 memset (gregs, 0, len);
7284e1be 744
f2db237a 745 ppc_collect_gregset (regset, regcache, regnum, gregs, len);
7284e1be
UW
746
747 if (ppc_linux_trap_reg_p (get_regcache_arch (regcache)))
748 {
749 /* "orig_r3" is stored 2 slots after "pc". */
750 if (regnum == -1 || regnum == PPC_ORIG_R3_REGNUM)
751 ppc_collect_reg (regcache, PPC_ORIG_R3_REGNUM, gregs,
752 offsets->pc_offset + 2 * offsets->gpr_size,
753 offsets->gpr_size);
754
755 /* "trap" is stored 8 slots after "pc". */
756 if (regnum == -1 || regnum == PPC_TRAP_REGNUM)
757 ppc_collect_reg (regcache, PPC_TRAP_REGNUM, gregs,
758 offsets->pc_offset + 8 * offsets->gpr_size,
759 offsets->gpr_size);
760 }
f9be684a
AC
761}
762
f2db237a
AM
763/* Regset descriptions. */
764static const struct ppc_reg_offsets ppc32_linux_reg_offsets =
765 {
766 /* General-purpose registers. */
767 /* .r0_offset = */ 0,
768 /* .gpr_size = */ 4,
769 /* .xr_size = */ 4,
770 /* .pc_offset = */ 128,
771 /* .ps_offset = */ 132,
772 /* .cr_offset = */ 152,
773 /* .lr_offset = */ 144,
774 /* .ctr_offset = */ 140,
775 /* .xer_offset = */ 148,
776 /* .mq_offset = */ 156,
777
778 /* Floating-point registers. */
779 /* .f0_offset = */ 0,
780 /* .fpscr_offset = */ 256,
781 /* .fpscr_size = */ 8,
782
783 /* AltiVec registers. */
784 /* .vr0_offset = */ 0,
06caf7d2
CES
785 /* .vscr_offset = */ 512 + 12,
786 /* .vrsave_offset = */ 528
f2db237a 787 };
f9be684a 788
f2db237a
AM
789static const struct ppc_reg_offsets ppc64_linux_reg_offsets =
790 {
791 /* General-purpose registers. */
792 /* .r0_offset = */ 0,
793 /* .gpr_size = */ 8,
794 /* .xr_size = */ 8,
795 /* .pc_offset = */ 256,
796 /* .ps_offset = */ 264,
797 /* .cr_offset = */ 304,
798 /* .lr_offset = */ 288,
799 /* .ctr_offset = */ 280,
800 /* .xer_offset = */ 296,
801 /* .mq_offset = */ 312,
802
803 /* Floating-point registers. */
804 /* .f0_offset = */ 0,
805 /* .fpscr_offset = */ 256,
806 /* .fpscr_size = */ 8,
807
808 /* AltiVec registers. */
809 /* .vr0_offset = */ 0,
06caf7d2
CES
810 /* .vscr_offset = */ 512 + 12,
811 /* .vrsave_offset = */ 528
f2db237a 812 };
2fda4977 813
f2db237a
AM
814static const struct regset ppc32_linux_gregset = {
815 &ppc32_linux_reg_offsets,
7284e1be 816 ppc_linux_supply_gregset,
f2db237a
AM
817 ppc_linux_collect_gregset,
818 NULL
f9be684a
AC
819};
820
f2db237a
AM
821static const struct regset ppc64_linux_gregset = {
822 &ppc64_linux_reg_offsets,
7284e1be 823 ppc_linux_supply_gregset,
f2db237a
AM
824 ppc_linux_collect_gregset,
825 NULL
826};
f9be684a 827
f2db237a
AM
828static const struct regset ppc32_linux_fpregset = {
829 &ppc32_linux_reg_offsets,
830 ppc_supply_fpregset,
831 ppc_collect_fpregset,
832 NULL
f9be684a
AC
833};
834
06caf7d2
CES
835static const struct regset ppc32_linux_vrregset = {
836 &ppc32_linux_reg_offsets,
837 ppc_supply_vrregset,
838 ppc_collect_vrregset,
839 NULL
840};
841
604c2f83
LM
842static const struct regset ppc32_linux_vsxregset = {
843 &ppc32_linux_reg_offsets,
844 ppc_supply_vsxregset,
845 ppc_collect_vsxregset,
846 NULL
847};
848
f2db237a
AM
849const struct regset *
850ppc_linux_gregset (int wordsize)
2fda4977 851{
f2db237a 852 return wordsize == 8 ? &ppc64_linux_gregset : &ppc32_linux_gregset;
2fda4977
DJ
853}
854
f2db237a
AM
855const struct regset *
856ppc_linux_fpregset (void)
857{
858 return &ppc32_linux_fpregset;
859}
2fda4977 860
f9be684a
AC
861static const struct regset *
862ppc_linux_regset_from_core_section (struct gdbarch *core_arch,
863 const char *sect_name, size_t sect_size)
2fda4977 864{
f9be684a
AC
865 struct gdbarch_tdep *tdep = gdbarch_tdep (core_arch);
866 if (strcmp (sect_name, ".reg") == 0)
2fda4977 867 {
f9be684a
AC
868 if (tdep->wordsize == 4)
869 return &ppc32_linux_gregset;
2fda4977 870 else
f9be684a 871 return &ppc64_linux_gregset;
2fda4977 872 }
f9be684a 873 if (strcmp (sect_name, ".reg2") == 0)
f2db237a 874 return &ppc32_linux_fpregset;
06caf7d2
CES
875 if (strcmp (sect_name, ".reg-ppc-vmx") == 0)
876 return &ppc32_linux_vrregset;
604c2f83
LM
877 if (strcmp (sect_name, ".reg-ppc-vsx") == 0)
878 return &ppc32_linux_vsxregset;
f9be684a 879 return NULL;
2fda4977
DJ
880}
881
a8f60bfc 882static void
5366653e 883ppc_linux_sigtramp_cache (struct frame_info *this_frame,
a8f60bfc
AC
884 struct trad_frame_cache *this_cache,
885 CORE_ADDR func, LONGEST offset,
886 int bias)
887{
888 CORE_ADDR base;
889 CORE_ADDR regs;
890 CORE_ADDR gpregs;
891 CORE_ADDR fpregs;
892 int i;
5366653e 893 struct gdbarch *gdbarch = get_frame_arch (this_frame);
a8f60bfc 894 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
e17a4113 895 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
a8f60bfc 896
5366653e
DJ
897 base = get_frame_register_unsigned (this_frame,
898 gdbarch_sp_regnum (gdbarch));
899 if (bias > 0 && get_frame_pc (this_frame) != func)
a8f60bfc
AC
900 /* See below, some signal trampolines increment the stack as their
901 first instruction, need to compensate for that. */
902 base -= bias;
903
904 /* Find the address of the register buffer pointer. */
905 regs = base + offset;
906 /* Use that to find the address of the corresponding register
907 buffers. */
e17a4113 908 gpregs = read_memory_unsigned_integer (regs, tdep->wordsize, byte_order);
a8f60bfc
AC
909 fpregs = gpregs + 48 * tdep->wordsize;
910
911 /* General purpose. */
912 for (i = 0; i < 32; i++)
913 {
914 int regnum = i + tdep->ppc_gp0_regnum;
0df8b418
MS
915 trad_frame_set_reg_addr (this_cache,
916 regnum, gpregs + i * tdep->wordsize);
a8f60bfc 917 }
3e8c568d 918 trad_frame_set_reg_addr (this_cache,
40a6adc1 919 gdbarch_pc_regnum (gdbarch),
3e8c568d 920 gpregs + 32 * tdep->wordsize);
a8f60bfc
AC
921 trad_frame_set_reg_addr (this_cache, tdep->ppc_ctr_regnum,
922 gpregs + 35 * tdep->wordsize);
923 trad_frame_set_reg_addr (this_cache, tdep->ppc_lr_regnum,
924 gpregs + 36 * tdep->wordsize);
925 trad_frame_set_reg_addr (this_cache, tdep->ppc_xer_regnum,
926 gpregs + 37 * tdep->wordsize);
927 trad_frame_set_reg_addr (this_cache, tdep->ppc_cr_regnum,
928 gpregs + 38 * tdep->wordsize);
929
7284e1be
UW
930 if (ppc_linux_trap_reg_p (gdbarch))
931 {
932 trad_frame_set_reg_addr (this_cache, PPC_ORIG_R3_REGNUM,
933 gpregs + 34 * tdep->wordsize);
934 trad_frame_set_reg_addr (this_cache, PPC_TRAP_REGNUM,
935 gpregs + 40 * tdep->wordsize);
936 }
937
60f140f9
PG
938 if (ppc_floating_point_unit_p (gdbarch))
939 {
940 /* Floating point registers. */
941 for (i = 0; i < 32; i++)
942 {
40a6adc1 943 int regnum = i + gdbarch_fp0_regnum (gdbarch);
60f140f9
PG
944 trad_frame_set_reg_addr (this_cache, regnum,
945 fpregs + i * tdep->wordsize);
946 }
947 trad_frame_set_reg_addr (this_cache, tdep->ppc_fpscr_regnum,
4019046a 948 fpregs + 32 * tdep->wordsize);
60f140f9 949 }
a8f60bfc
AC
950 trad_frame_set_id (this_cache, frame_id_build (base, func));
951}
952
953static void
954ppc32_linux_sigaction_cache_init (const struct tramp_frame *self,
5366653e 955 struct frame_info *this_frame,
a8f60bfc
AC
956 struct trad_frame_cache *this_cache,
957 CORE_ADDR func)
958{
5366653e 959 ppc_linux_sigtramp_cache (this_frame, this_cache, func,
a8f60bfc
AC
960 0xd0 /* Offset to ucontext_t. */
961 + 0x30 /* Offset to .reg. */,
962 0);
963}
964
965static void
966ppc64_linux_sigaction_cache_init (const struct tramp_frame *self,
5366653e 967 struct frame_info *this_frame,
a8f60bfc
AC
968 struct trad_frame_cache *this_cache,
969 CORE_ADDR func)
970{
5366653e 971 ppc_linux_sigtramp_cache (this_frame, this_cache, func,
a8f60bfc
AC
972 0x80 /* Offset to ucontext_t. */
973 + 0xe0 /* Offset to .reg. */,
974 128);
975}
976
977static void
978ppc32_linux_sighandler_cache_init (const struct tramp_frame *self,
5366653e 979 struct frame_info *this_frame,
a8f60bfc
AC
980 struct trad_frame_cache *this_cache,
981 CORE_ADDR func)
982{
5366653e 983 ppc_linux_sigtramp_cache (this_frame, this_cache, func,
a8f60bfc
AC
984 0x40 /* Offset to ucontext_t. */
985 + 0x1c /* Offset to .reg. */,
986 0);
987}
988
989static void
990ppc64_linux_sighandler_cache_init (const struct tramp_frame *self,
5366653e 991 struct frame_info *this_frame,
a8f60bfc
AC
992 struct trad_frame_cache *this_cache,
993 CORE_ADDR func)
994{
5366653e 995 ppc_linux_sigtramp_cache (this_frame, this_cache, func,
a8f60bfc
AC
996 0x80 /* Offset to struct sigcontext. */
997 + 0x38 /* Offset to .reg. */,
998 128);
999}
1000
1001static struct tramp_frame ppc32_linux_sigaction_tramp_frame = {
1002 SIGTRAMP_FRAME,
1003 4,
1004 {
1005 { 0x380000ac, -1 }, /* li r0, 172 */
1006 { 0x44000002, -1 }, /* sc */
1007 { TRAMP_SENTINEL_INSN },
1008 },
1009 ppc32_linux_sigaction_cache_init
1010};
1011static struct tramp_frame ppc64_linux_sigaction_tramp_frame = {
1012 SIGTRAMP_FRAME,
1013 4,
1014 {
1015 { 0x38210080, -1 }, /* addi r1,r1,128 */
1016 { 0x380000ac, -1 }, /* li r0, 172 */
1017 { 0x44000002, -1 }, /* sc */
1018 { TRAMP_SENTINEL_INSN },
1019 },
1020 ppc64_linux_sigaction_cache_init
1021};
1022static struct tramp_frame ppc32_linux_sighandler_tramp_frame = {
1023 SIGTRAMP_FRAME,
1024 4,
1025 {
1026 { 0x38000077, -1 }, /* li r0,119 */
1027 { 0x44000002, -1 }, /* sc */
1028 { TRAMP_SENTINEL_INSN },
1029 },
1030 ppc32_linux_sighandler_cache_init
1031};
1032static struct tramp_frame ppc64_linux_sighandler_tramp_frame = {
1033 SIGTRAMP_FRAME,
1034 4,
1035 {
1036 { 0x38210080, -1 }, /* addi r1,r1,128 */
1037 { 0x38000077, -1 }, /* li r0,119 */
1038 { 0x44000002, -1 }, /* sc */
1039 { TRAMP_SENTINEL_INSN },
1040 },
1041 ppc64_linux_sighandler_cache_init
1042};
1043
7284e1be 1044
85e747d2
UW
1045/* Address to use for displaced stepping. When debugging a stand-alone
1046 SPU executable, entry_point_address () will point to an SPU local-store
1047 address and is thus not usable as displaced stepping location. We use
1048 the auxiliary vector to determine the PowerPC-side entry point address
1049 instead. */
1050
1051static CORE_ADDR ppc_linux_entry_point_addr = 0;
1052
1053static void
1054ppc_linux_inferior_created (struct target_ops *target, int from_tty)
1055{
1056 ppc_linux_entry_point_addr = 0;
1057}
1058
1059static CORE_ADDR
1060ppc_linux_displaced_step_location (struct gdbarch *gdbarch)
1061{
1062 if (ppc_linux_entry_point_addr == 0)
1063 {
1064 CORE_ADDR addr;
1065
1066 /* Determine entry point from target auxiliary vector. */
1067 if (target_auxv_search (&current_target, AT_ENTRY, &addr) <= 0)
1068 error (_("Cannot find AT_ENTRY auxiliary vector entry."));
1069
1070 /* Make certain that the address points at real code, and not a
1071 function descriptor. */
1072 addr = gdbarch_convert_from_func_ptr_addr (gdbarch, addr,
1073 &current_target);
1074
1075 /* Inferior calls also use the entry point as a breakpoint location.
1076 We don't want displaced stepping to interfere with those
1077 breakpoints, so leave space. */
1078 ppc_linux_entry_point_addr = addr + 2 * PPC_INSN_SIZE;
1079 }
1080
1081 return ppc_linux_entry_point_addr;
1082}
1083
1084
7284e1be
UW
1085/* Return 1 if PPC_ORIG_R3_REGNUM and PPC_TRAP_REGNUM are usable. */
1086int
1087ppc_linux_trap_reg_p (struct gdbarch *gdbarch)
1088{
1089 /* If we do not have a target description with registers, then
1090 the special registers will not be included in the register set. */
1091 if (!tdesc_has_registers (gdbarch_target_desc (gdbarch)))
1092 return 0;
1093
1094 /* If we do, then it is safe to check the size. */
1095 return register_size (gdbarch, PPC_ORIG_R3_REGNUM) > 0
1096 && register_size (gdbarch, PPC_TRAP_REGNUM) > 0;
1097}
1098
a96d9b2e
SDJ
1099/* Return the current system call's number present in the
1100 r0 register. When the function fails, it returns -1. */
1101static LONGEST
1102ppc_linux_get_syscall_number (struct gdbarch *gdbarch,
1103 ptid_t ptid)
1104{
1105 struct regcache *regcache = get_thread_regcache (ptid);
1106 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
1107 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
1108 struct cleanup *cleanbuf;
1109 /* The content of a register */
1110 gdb_byte *buf;
1111 /* The result */
1112 LONGEST ret;
1113
1114 /* Make sure we're in a 32- or 64-bit machine */
1115 gdb_assert (tdep->wordsize == 4 || tdep->wordsize == 8);
1116
1117 buf = (gdb_byte *) xmalloc (tdep->wordsize * sizeof (gdb_byte));
1118
1119 cleanbuf = make_cleanup (xfree, buf);
1120
1121 /* Getting the system call number from the register.
1122 When dealing with PowerPC architecture, this information
1123 is stored at 0th register. */
1124 regcache_cooked_read (regcache, tdep->ppc_gp0_regnum, buf);
1125
1126 ret = extract_signed_integer (buf, tdep->wordsize, byte_order);
1127 do_cleanups (cleanbuf);
1128
1129 return ret;
1130}
1131
7284e1be
UW
1132static void
1133ppc_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
1134{
1135 struct gdbarch *gdbarch = get_regcache_arch (regcache);
1136
1137 regcache_cooked_write_unsigned (regcache, gdbarch_pc_regnum (gdbarch), pc);
1138
1139 /* Set special TRAP register to -1 to prevent the kernel from
1140 messing with the PC we just installed, if we happen to be
1141 within an interrupted system call that the kernel wants to
1142 restart.
1143
1144 Note that after we return from the dummy call, the TRAP and
1145 ORIG_R3 registers will be automatically restored, and the
1146 kernel continues to restart the system call at this point. */
1147 if (ppc_linux_trap_reg_p (gdbarch))
1148 regcache_cooked_write_unsigned (regcache, PPC_TRAP_REGNUM, -1);
1149}
1150
f4d9bade
UW
1151static int
1152ppc_linux_spu_section (bfd *abfd, asection *asect, void *user_data)
1153{
1154 return strncmp (bfd_section_name (abfd, asect), "SPU/", 4) == 0;
1155}
1156
7284e1be
UW
1157static const struct target_desc *
1158ppc_linux_core_read_description (struct gdbarch *gdbarch,
1159 struct target_ops *target,
1160 bfd *abfd)
1161{
f4d9bade 1162 asection *cell = bfd_sections_find_if (abfd, ppc_linux_spu_section, NULL);
7284e1be 1163 asection *altivec = bfd_get_section_by_name (abfd, ".reg-ppc-vmx");
604c2f83 1164 asection *vsx = bfd_get_section_by_name (abfd, ".reg-ppc-vsx");
7284e1be
UW
1165 asection *section = bfd_get_section_by_name (abfd, ".reg");
1166 if (! section)
1167 return NULL;
1168
1169 switch (bfd_section_size (abfd, section))
1170 {
1171 case 48 * 4:
f4d9bade
UW
1172 if (cell)
1173 return tdesc_powerpc_cell32l;
1174 else if (vsx)
604c2f83
LM
1175 return tdesc_powerpc_vsx32l;
1176 else if (altivec)
1177 return tdesc_powerpc_altivec32l;
1178 else
1179 return tdesc_powerpc_32l;
7284e1be
UW
1180
1181 case 48 * 8:
f4d9bade
UW
1182 if (cell)
1183 return tdesc_powerpc_cell64l;
1184 else if (vsx)
604c2f83
LM
1185 return tdesc_powerpc_vsx64l;
1186 else if (altivec)
1187 return tdesc_powerpc_altivec64l;
1188 else
1189 return tdesc_powerpc_64l;
7284e1be
UW
1190
1191 default:
1192 return NULL;
1193 }
1194}
1195
cc5f0d61
UW
1196
1197/* Cell/B.E. active SPE context tracking support. */
1198
1199static struct objfile *spe_context_objfile = NULL;
1200static CORE_ADDR spe_context_lm_addr = 0;
1201static CORE_ADDR spe_context_offset = 0;
1202
1203static ptid_t spe_context_cache_ptid;
1204static CORE_ADDR spe_context_cache_address;
1205
1206/* Hook into inferior_created, solib_loaded, and solib_unloaded observers
1207 to track whether we've loaded a version of libspe2 (as static or dynamic
1208 library) that provides the __spe_current_active_context variable. */
1209static void
1210ppc_linux_spe_context_lookup (struct objfile *objfile)
1211{
1212 struct minimal_symbol *sym;
1213
1214 if (!objfile)
1215 {
1216 spe_context_objfile = NULL;
1217 spe_context_lm_addr = 0;
1218 spe_context_offset = 0;
1219 spe_context_cache_ptid = minus_one_ptid;
1220 spe_context_cache_address = 0;
1221 return;
1222 }
1223
1224 sym = lookup_minimal_symbol ("__spe_current_active_context", NULL, objfile);
1225 if (sym)
1226 {
1227 spe_context_objfile = objfile;
1228 spe_context_lm_addr = svr4_fetch_objfile_link_map (objfile);
1229 spe_context_offset = SYMBOL_VALUE_ADDRESS (sym);
1230 spe_context_cache_ptid = minus_one_ptid;
1231 spe_context_cache_address = 0;
1232 return;
1233 }
1234}
1235
1236static void
1237ppc_linux_spe_context_inferior_created (struct target_ops *t, int from_tty)
1238{
1239 struct objfile *objfile;
1240
1241 ppc_linux_spe_context_lookup (NULL);
1242 ALL_OBJFILES (objfile)
1243 ppc_linux_spe_context_lookup (objfile);
1244}
1245
1246static void
1247ppc_linux_spe_context_solib_loaded (struct so_list *so)
1248{
1249 if (strstr (so->so_original_name, "/libspe") != NULL)
1250 {
7e559477 1251 solib_read_symbols (so, 0);
cc5f0d61
UW
1252 ppc_linux_spe_context_lookup (so->objfile);
1253 }
1254}
1255
1256static void
1257ppc_linux_spe_context_solib_unloaded (struct so_list *so)
1258{
1259 if (so->objfile == spe_context_objfile)
1260 ppc_linux_spe_context_lookup (NULL);
1261}
1262
1263/* Retrieve contents of the N'th element in the current thread's
1264 linked SPE context list into ID and NPC. Return the address of
1265 said context element, or 0 if not found. */
1266static CORE_ADDR
1267ppc_linux_spe_context (int wordsize, enum bfd_endian byte_order,
1268 int n, int *id, unsigned int *npc)
1269{
1270 CORE_ADDR spe_context = 0;
1271 gdb_byte buf[16];
1272 int i;
1273
1274 /* Quick exit if we have not found __spe_current_active_context. */
1275 if (!spe_context_objfile)
1276 return 0;
1277
1278 /* Look up cached address of thread-local variable. */
1279 if (!ptid_equal (spe_context_cache_ptid, inferior_ptid))
1280 {
1281 struct target_ops *target = &current_target;
1282 volatile struct gdb_exception ex;
1283
1284 while (target && !target->to_get_thread_local_address)
1285 target = find_target_beneath (target);
1286 if (!target)
1287 return 0;
1288
1289 TRY_CATCH (ex, RETURN_MASK_ERROR)
1290 {
1291 /* We do not call target_translate_tls_address here, because
1292 svr4_fetch_objfile_link_map may invalidate the frame chain,
1293 which must not do while inside a frame sniffer.
1294
1295 Instead, we have cached the lm_addr value, and use that to
1296 directly call the target's to_get_thread_local_address. */
1297 spe_context_cache_address
1298 = target->to_get_thread_local_address (target, inferior_ptid,
1299 spe_context_lm_addr,
1300 spe_context_offset);
1301 spe_context_cache_ptid = inferior_ptid;
1302 }
1303
1304 if (ex.reason < 0)
1305 return 0;
1306 }
1307
1308 /* Read variable value. */
1309 if (target_read_memory (spe_context_cache_address, buf, wordsize) == 0)
1310 spe_context = extract_unsigned_integer (buf, wordsize, byte_order);
1311
1312 /* Cyle through to N'th linked list element. */
1313 for (i = 0; i < n && spe_context; i++)
1314 if (target_read_memory (spe_context + align_up (12, wordsize),
1315 buf, wordsize) == 0)
1316 spe_context = extract_unsigned_integer (buf, wordsize, byte_order);
1317 else
1318 spe_context = 0;
1319
1320 /* Read current context. */
1321 if (spe_context
1322 && target_read_memory (spe_context, buf, 12) != 0)
1323 spe_context = 0;
1324
1325 /* Extract data elements. */
1326 if (spe_context)
1327 {
1328 if (id)
1329 *id = extract_signed_integer (buf, 4, byte_order);
1330 if (npc)
1331 *npc = extract_unsigned_integer (buf + 4, 4, byte_order);
1332 }
1333
1334 return spe_context;
1335}
1336
1337
1338/* Cell/B.E. cross-architecture unwinder support. */
1339
1340struct ppu2spu_cache
1341{
1342 struct frame_id frame_id;
1343 struct regcache *regcache;
1344};
1345
1346static struct gdbarch *
1347ppu2spu_prev_arch (struct frame_info *this_frame, void **this_cache)
1348{
1349 struct ppu2spu_cache *cache = *this_cache;
1350 return get_regcache_arch (cache->regcache);
1351}
1352
1353static void
1354ppu2spu_this_id (struct frame_info *this_frame,
1355 void **this_cache, struct frame_id *this_id)
1356{
1357 struct ppu2spu_cache *cache = *this_cache;
1358 *this_id = cache->frame_id;
1359}
1360
1361static struct value *
1362ppu2spu_prev_register (struct frame_info *this_frame,
1363 void **this_cache, int regnum)
1364{
1365 struct ppu2spu_cache *cache = *this_cache;
1366 struct gdbarch *gdbarch = get_regcache_arch (cache->regcache);
1367 gdb_byte *buf;
1368
1369 buf = alloca (register_size (gdbarch, regnum));
1370 regcache_cooked_read (cache->regcache, regnum, buf);
1371 return frame_unwind_got_bytes (this_frame, regnum, buf);
1372}
1373
1374struct ppu2spu_data
1375{
1376 struct gdbarch *gdbarch;
1377 int id;
1378 unsigned int npc;
1379 gdb_byte gprs[128*16];
1380};
1381
1382static int
1383ppu2spu_unwind_register (void *src, int regnum, gdb_byte *buf)
1384{
1385 struct ppu2spu_data *data = src;
1386 enum bfd_endian byte_order = gdbarch_byte_order (data->gdbarch);
1387
1388 if (regnum >= 0 && regnum < SPU_NUM_GPRS)
1389 memcpy (buf, data->gprs + 16*regnum, 16);
1390 else if (regnum == SPU_ID_REGNUM)
1391 store_unsigned_integer (buf, 4, byte_order, data->id);
1392 else if (regnum == SPU_PC_REGNUM)
1393 store_unsigned_integer (buf, 4, byte_order, data->npc);
1394 else
1395 return 0;
1396
1397 return 1;
1398}
1399
1400static int
1401ppu2spu_sniffer (const struct frame_unwind *self,
1402 struct frame_info *this_frame, void **this_prologue_cache)
1403{
1404 struct gdbarch *gdbarch = get_frame_arch (this_frame);
1405 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
1406 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
1407 struct ppu2spu_data data;
1408 struct frame_info *fi;
1409 CORE_ADDR base, func, backchain, spe_context;
1410 gdb_byte buf[8];
1411 int n = 0;
1412
1413 /* Count the number of SPU contexts already in the frame chain. */
1414 for (fi = get_next_frame (this_frame); fi; fi = get_next_frame (fi))
1415 if (get_frame_type (fi) == ARCH_FRAME
1416 && gdbarch_bfd_arch_info (get_frame_arch (fi))->arch == bfd_arch_spu)
1417 n++;
1418
1419 base = get_frame_sp (this_frame);
1420 func = get_frame_pc (this_frame);
1421 if (target_read_memory (base, buf, tdep->wordsize))
1422 return 0;
1423 backchain = extract_unsigned_integer (buf, tdep->wordsize, byte_order);
1424
1425 spe_context = ppc_linux_spe_context (tdep->wordsize, byte_order,
1426 n, &data.id, &data.npc);
1427 if (spe_context && base <= spe_context && spe_context < backchain)
1428 {
1429 char annex[32];
1430
1431 /* Find gdbarch for SPU. */
1432 struct gdbarch_info info;
1433 gdbarch_info_init (&info);
1434 info.bfd_arch_info = bfd_lookup_arch (bfd_arch_spu, bfd_mach_spu);
1435 info.byte_order = BFD_ENDIAN_BIG;
1436 info.osabi = GDB_OSABI_LINUX;
1437 info.tdep_info = (void *) &data.id;
1438 data.gdbarch = gdbarch_find_by_info (info);
1439 if (!data.gdbarch)
1440 return 0;
1441
1442 xsnprintf (annex, sizeof annex, "%d/regs", data.id);
1443 if (target_read (&current_target, TARGET_OBJECT_SPU, annex,
1444 data.gprs, 0, sizeof data.gprs)
1445 == sizeof data.gprs)
1446 {
1447 struct ppu2spu_cache *cache
1448 = FRAME_OBSTACK_CALLOC (1, struct ppu2spu_cache);
1449
d37346f0
DJ
1450 struct address_space *aspace = get_frame_address_space (this_frame);
1451 struct regcache *regcache = regcache_xmalloc (data.gdbarch, aspace);
cc5f0d61
UW
1452 struct cleanup *cleanups = make_cleanup_regcache_xfree (regcache);
1453 regcache_save (regcache, ppu2spu_unwind_register, &data);
1454 discard_cleanups (cleanups);
1455
1456 cache->frame_id = frame_id_build (base, func);
1457 cache->regcache = regcache;
1458 *this_prologue_cache = cache;
1459 return 1;
1460 }
1461 }
1462
1463 return 0;
1464}
1465
1466static void
1467ppu2spu_dealloc_cache (struct frame_info *self, void *this_cache)
1468{
1469 struct ppu2spu_cache *cache = this_cache;
1470 regcache_xfree (cache->regcache);
1471}
1472
1473static const struct frame_unwind ppu2spu_unwind = {
1474 ARCH_FRAME,
1475 ppu2spu_this_id,
1476 ppu2spu_prev_register,
1477 NULL,
1478 ppu2spu_sniffer,
1479 ppu2spu_dealloc_cache,
1480 ppu2spu_prev_arch,
1481};
1482
1483
7b112f9c
JT
1484static void
1485ppc_linux_init_abi (struct gdbarch_info info,
1486 struct gdbarch *gdbarch)
1487{
1488 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
7284e1be 1489 struct tdesc_arch_data *tdesc_data = (void *) info.tdep_info;
7b112f9c 1490
a5ee0f0c
PA
1491 linux_init_abi (info, gdbarch);
1492
b14d30e1
JM
1493 /* PPC GNU/Linux uses either 64-bit or 128-bit long doubles; where
1494 128-bit, they are IBM long double, not IEEE quad long double as
1495 in the System V ABI PowerPC Processor Supplement. We can safely
1496 let them default to 128-bit, since the debug info will give the
1497 size of type actually used in each case. */
1498 set_gdbarch_long_double_bit (gdbarch, 16 * TARGET_CHAR_BIT);
1499 set_gdbarch_long_double_format (gdbarch, floatformats_ibm_long_double);
0598a43c 1500
7284e1be
UW
1501 /* Handle inferior calls during interrupted system calls. */
1502 set_gdbarch_write_pc (gdbarch, ppc_linux_write_pc);
1503
a96d9b2e
SDJ
1504 /* Get the syscall number from the arch's register. */
1505 set_gdbarch_get_syscall_number (gdbarch, ppc_linux_get_syscall_number);
1506
7b112f9c
JT
1507 if (tdep->wordsize == 4)
1508 {
b9ff3018
AC
1509 /* Until November 2001, gcc did not comply with the 32 bit SysV
1510 R4 ABI requirement that structures less than or equal to 8
1511 bytes should be returned in registers. Instead GCC was using
b021a221 1512 the AIX/PowerOpen ABI - everything returned in memory
b9ff3018
AC
1513 (well ignoring vectors that is). When this was corrected, it
1514 wasn't fixed for GNU/Linux native platform. Use the
1515 PowerOpen struct convention. */
05580c65 1516 set_gdbarch_return_value (gdbarch, ppc_linux_return_value);
b9ff3018 1517
7b112f9c
JT
1518 set_gdbarch_memory_remove_breakpoint (gdbarch,
1519 ppc_linux_memory_remove_breakpoint);
61a65099 1520
f470a70a 1521 /* Shared library handling. */
8526f328 1522 set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
7b112f9c 1523 set_solib_svr4_fetch_link_map_offsets
76a9d10f 1524 (gdbarch, svr4_ilp32_fetch_link_map_offsets);
a8f60bfc 1525
a96d9b2e
SDJ
1526 /* Setting the correct XML syscall filename. */
1527 set_xml_syscall_file_name (XML_SYSCALL_FILENAME_PPC);
1528
a8f60bfc 1529 /* Trampolines. */
0df8b418
MS
1530 tramp_frame_prepend_unwinder (gdbarch,
1531 &ppc32_linux_sigaction_tramp_frame);
1532 tramp_frame_prepend_unwinder (gdbarch,
1533 &ppc32_linux_sighandler_tramp_frame);
a78c2d62
UW
1534
1535 /* BFD target for core files. */
1536 if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
1537 set_gdbarch_gcore_bfd_target (gdbarch, "elf32-powerpcle");
1538 else
1539 set_gdbarch_gcore_bfd_target (gdbarch, "elf32-powerpc");
2f2241f1
UW
1540
1541 /* Supported register sections. */
1542 if (tdesc_find_feature (info.target_desc,
1543 "org.gnu.gdb.power.vsx"))
1544 set_gdbarch_core_regset_sections (gdbarch,
1545 ppc_linux_vsx_regset_sections);
1546 else if (tdesc_find_feature (info.target_desc,
1547 "org.gnu.gdb.power.altivec"))
1548 set_gdbarch_core_regset_sections (gdbarch,
1549 ppc_linux_vmx_regset_sections);
1550 else
1551 set_gdbarch_core_regset_sections (gdbarch,
1552 ppc_linux_fp_regset_sections);
7b112f9c 1553 }
f470a70a
JB
1554
1555 if (tdep->wordsize == 8)
1556 {
00d5f93a
UW
1557 /* Handle PPC GNU/Linux 64-bit function pointers (which are really
1558 function descriptors). */
1559 set_gdbarch_convert_from_func_ptr_addr
1560 (gdbarch, ppc64_linux_convert_from_func_ptr_addr);
1561
fb318ff7 1562 /* Shared library handling. */
2bbe3cc1 1563 set_gdbarch_skip_trampoline_code (gdbarch, ppc64_skip_trampoline_code);
fb318ff7
DJ
1564 set_solib_svr4_fetch_link_map_offsets
1565 (gdbarch, svr4_lp64_fetch_link_map_offsets);
1566
a96d9b2e
SDJ
1567 /* Setting the correct XML syscall filename. */
1568 set_xml_syscall_file_name (XML_SYSCALL_FILENAME_PPC64);
1569
a8f60bfc 1570 /* Trampolines. */
0df8b418
MS
1571 tramp_frame_prepend_unwinder (gdbarch,
1572 &ppc64_linux_sigaction_tramp_frame);
1573 tramp_frame_prepend_unwinder (gdbarch,
1574 &ppc64_linux_sighandler_tramp_frame);
a78c2d62
UW
1575
1576 /* BFD target for core files. */
1577 if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
1578 set_gdbarch_gcore_bfd_target (gdbarch, "elf64-powerpcle");
1579 else
1580 set_gdbarch_gcore_bfd_target (gdbarch, "elf64-powerpc");
2f2241f1
UW
1581
1582 /* Supported register sections. */
1583 if (tdesc_find_feature (info.target_desc,
1584 "org.gnu.gdb.power.vsx"))
1585 set_gdbarch_core_regset_sections (gdbarch,
1586 ppc64_linux_vsx_regset_sections);
1587 else if (tdesc_find_feature (info.target_desc,
1588 "org.gnu.gdb.power.altivec"))
1589 set_gdbarch_core_regset_sections (gdbarch,
1590 ppc64_linux_vmx_regset_sections);
1591 else
1592 set_gdbarch_core_regset_sections (gdbarch,
1593 ppc64_linux_fp_regset_sections);
f470a70a 1594 }
0df8b418
MS
1595 set_gdbarch_regset_from_core_section (gdbarch,
1596 ppc_linux_regset_from_core_section);
7284e1be 1597 set_gdbarch_core_read_description (gdbarch, ppc_linux_core_read_description);
b2756930
KB
1598
1599 /* Enable TLS support. */
1600 set_gdbarch_fetch_tls_load_module_address (gdbarch,
1601 svr4_fetch_objfile_link_map);
7284e1be
UW
1602
1603 if (tdesc_data)
1604 {
1605 const struct tdesc_feature *feature;
1606
1607 /* If we have target-described registers, then we can safely
1608 reserve a number for PPC_ORIG_R3_REGNUM and PPC_TRAP_REGNUM
1609 (whether they are described or not). */
1610 gdb_assert (gdbarch_num_regs (gdbarch) <= PPC_ORIG_R3_REGNUM);
1611 set_gdbarch_num_regs (gdbarch, PPC_TRAP_REGNUM + 1);
1612
1613 /* If they are present, then assign them to the reserved number. */
1614 feature = tdesc_find_feature (info.target_desc,
1615 "org.gnu.gdb.power.linux");
1616 if (feature != NULL)
1617 {
1618 tdesc_numbered_register (feature, tdesc_data,
1619 PPC_ORIG_R3_REGNUM, "orig_r3");
1620 tdesc_numbered_register (feature, tdesc_data,
1621 PPC_TRAP_REGNUM, "trap");
1622 }
1623 }
85e747d2
UW
1624
1625 /* Enable Cell/B.E. if supported by the target. */
1626 if (tdesc_compatible_p (info.target_desc,
1627 bfd_lookup_arch (bfd_arch_spu, bfd_mach_spu)))
1628 {
1629 /* Cell/B.E. multi-architecture support. */
1630 set_spu_solib_ops (gdbarch);
1631
cc5f0d61
UW
1632 /* Cell/B.E. cross-architecture unwinder support. */
1633 frame_unwind_prepend_unwinder (gdbarch, &ppu2spu_unwind);
1634
85e747d2
UW
1635 /* The default displaced_step_at_entry_point doesn't work for
1636 SPU stand-alone executables. */
1637 set_gdbarch_displaced_step_location (gdbarch,
1638 ppc_linux_displaced_step_location);
1639 }
7b112f9c
JT
1640}
1641
63807e1d
PA
1642/* Provide a prototype to silence -Wmissing-prototypes. */
1643extern initialize_file_ftype _initialize_ppc_linux_tdep;
1644
7b112f9c
JT
1645void
1646_initialize_ppc_linux_tdep (void)
1647{
0a0a4ac3
AC
1648 /* Register for all sub-familes of the POWER/PowerPC: 32-bit and
1649 64-bit PowerPC, and the older rs6k. */
1650 gdbarch_register_osabi (bfd_arch_powerpc, bfd_mach_ppc, GDB_OSABI_LINUX,
1651 ppc_linux_init_abi);
1652 gdbarch_register_osabi (bfd_arch_powerpc, bfd_mach_ppc64, GDB_OSABI_LINUX,
1653 ppc_linux_init_abi);
1654 gdbarch_register_osabi (bfd_arch_rs6000, bfd_mach_rs6k, GDB_OSABI_LINUX,
1655 ppc_linux_init_abi);
7284e1be 1656
85e747d2
UW
1657 /* Attach to inferior_created observer. */
1658 observer_attach_inferior_created (ppc_linux_inferior_created);
1659
cc5f0d61
UW
1660 /* Attach to observers to track __spe_current_active_context. */
1661 observer_attach_inferior_created (ppc_linux_spe_context_inferior_created);
1662 observer_attach_solib_loaded (ppc_linux_spe_context_solib_loaded);
1663 observer_attach_solib_unloaded (ppc_linux_spe_context_solib_unloaded);
1664
7284e1be
UW
1665 /* Initialize the Linux target descriptions. */
1666 initialize_tdesc_powerpc_32l ();
1667 initialize_tdesc_powerpc_altivec32l ();
f4d9bade 1668 initialize_tdesc_powerpc_cell32l ();
604c2f83 1669 initialize_tdesc_powerpc_vsx32l ();
69abc51c
TJB
1670 initialize_tdesc_powerpc_isa205_32l ();
1671 initialize_tdesc_powerpc_isa205_altivec32l ();
1672 initialize_tdesc_powerpc_isa205_vsx32l ();
7284e1be
UW
1673 initialize_tdesc_powerpc_64l ();
1674 initialize_tdesc_powerpc_altivec64l ();
f4d9bade 1675 initialize_tdesc_powerpc_cell64l ();
604c2f83 1676 initialize_tdesc_powerpc_vsx64l ();
69abc51c
TJB
1677 initialize_tdesc_powerpc_isa205_64l ();
1678 initialize_tdesc_powerpc_isa205_altivec64l ();
1679 initialize_tdesc_powerpc_isa205_vsx64l ();
7284e1be 1680 initialize_tdesc_powerpc_e500l ();
7b112f9c 1681}
This page took 1.643449 seconds and 4 git commands to generate.