OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-7.2/] [gdb/] [ppc-linux-tdep.c] - Blame information for rev 445

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.