1b725ae77Skettenis /* Target-dependent code for GDB, the GNU debugger.
2b725ae77Skettenis
3b725ae77Skettenis Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996,
4*11efff7fSkettenis 1997, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
5b725ae77Skettenis
6b725ae77Skettenis This file is part of GDB.
7b725ae77Skettenis
8b725ae77Skettenis This program is free software; you can redistribute it and/or modify
9b725ae77Skettenis it under the terms of the GNU General Public License as published by
10b725ae77Skettenis the Free Software Foundation; either version 2 of the License, or
11b725ae77Skettenis (at your option) any later version.
12b725ae77Skettenis
13b725ae77Skettenis This program is distributed in the hope that it will be useful,
14b725ae77Skettenis but WITHOUT ANY WARRANTY; without even the implied warranty of
15b725ae77Skettenis MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16b725ae77Skettenis GNU General Public License for more details.
17b725ae77Skettenis
18b725ae77Skettenis You should have received a copy of the GNU General Public License
19b725ae77Skettenis along with this program; if not, write to the Free Software
20b725ae77Skettenis Foundation, Inc., 59 Temple Place - Suite 330,
21b725ae77Skettenis Boston, MA 02111-1307, USA. */
22b725ae77Skettenis
23b725ae77Skettenis #include "defs.h"
24b725ae77Skettenis #include "frame.h"
25b725ae77Skettenis #include "inferior.h"
26b725ae77Skettenis #include "symtab.h"
27b725ae77Skettenis #include "target.h"
28b725ae77Skettenis #include "gdbcore.h"
29b725ae77Skettenis #include "gdbcmd.h"
30b725ae77Skettenis #include "symfile.h"
31b725ae77Skettenis #include "objfiles.h"
32b725ae77Skettenis #include "regcache.h"
33b725ae77Skettenis #include "value.h"
34b725ae77Skettenis #include "osabi.h"
35*11efff7fSkettenis #include "regset.h"
36b725ae77Skettenis #include "solib-svr4.h"
37b725ae77Skettenis #include "ppc-tdep.h"
38*11efff7fSkettenis #include "trad-frame.h"
39*11efff7fSkettenis #include "frame-unwind.h"
40b725ae77Skettenis
41b725ae77Skettenis /* The following instructions are used in the signal trampoline code
42b725ae77Skettenis on GNU/Linux PPC. The kernel used to use magic syscalls 0x6666 and
43b725ae77Skettenis 0x7777 but now uses the sigreturn syscalls. We check for both. */
44b725ae77Skettenis #define INSTR_LI_R0_0x6666 0x38006666
45b725ae77Skettenis #define INSTR_LI_R0_0x7777 0x38007777
46b725ae77Skettenis #define INSTR_LI_R0_NR_sigreturn 0x38000077
47b725ae77Skettenis #define INSTR_LI_R0_NR_rt_sigreturn 0x380000AC
48b725ae77Skettenis
49b725ae77Skettenis #define INSTR_SC 0x44000002
50b725ae77Skettenis
51b725ae77Skettenis /* Since the *-tdep.c files are platform independent (i.e, they may be
52b725ae77Skettenis used to build cross platform debuggers), we can't include system
53b725ae77Skettenis headers. Therefore, details concerning the sigcontext structure
54b725ae77Skettenis must be painstakingly rerecorded. What's worse, if these details
55b725ae77Skettenis ever change in the header files, they'll have to be changed here
56b725ae77Skettenis as well. */
57b725ae77Skettenis
58b725ae77Skettenis /* __SIGNAL_FRAMESIZE from <asm/ptrace.h> */
59b725ae77Skettenis #define PPC_LINUX_SIGNAL_FRAMESIZE 64
60b725ae77Skettenis
61b725ae77Skettenis /* From <asm/sigcontext.h>, offsetof(struct sigcontext_struct, regs) == 0x1c */
62b725ae77Skettenis #define PPC_LINUX_REGS_PTR_OFFSET (PPC_LINUX_SIGNAL_FRAMESIZE + 0x1c)
63b725ae77Skettenis
64b725ae77Skettenis /* From <asm/sigcontext.h>,
65b725ae77Skettenis offsetof(struct sigcontext_struct, handler) == 0x14 */
66b725ae77Skettenis #define PPC_LINUX_HANDLER_PTR_OFFSET (PPC_LINUX_SIGNAL_FRAMESIZE + 0x14)
67b725ae77Skettenis
68b725ae77Skettenis /* From <asm/ptrace.h>, values for PT_NIP, PT_R1, and PT_LNK */
69b725ae77Skettenis #define PPC_LINUX_PT_R0 0
70b725ae77Skettenis #define PPC_LINUX_PT_R1 1
71b725ae77Skettenis #define PPC_LINUX_PT_R2 2
72b725ae77Skettenis #define PPC_LINUX_PT_R3 3
73b725ae77Skettenis #define PPC_LINUX_PT_R4 4
74b725ae77Skettenis #define PPC_LINUX_PT_R5 5
75b725ae77Skettenis #define PPC_LINUX_PT_R6 6
76b725ae77Skettenis #define PPC_LINUX_PT_R7 7
77b725ae77Skettenis #define PPC_LINUX_PT_R8 8
78b725ae77Skettenis #define PPC_LINUX_PT_R9 9
79b725ae77Skettenis #define PPC_LINUX_PT_R10 10
80b725ae77Skettenis #define PPC_LINUX_PT_R11 11
81b725ae77Skettenis #define PPC_LINUX_PT_R12 12
82b725ae77Skettenis #define PPC_LINUX_PT_R13 13
83b725ae77Skettenis #define PPC_LINUX_PT_R14 14
84b725ae77Skettenis #define PPC_LINUX_PT_R15 15
85b725ae77Skettenis #define PPC_LINUX_PT_R16 16
86b725ae77Skettenis #define PPC_LINUX_PT_R17 17
87b725ae77Skettenis #define PPC_LINUX_PT_R18 18
88b725ae77Skettenis #define PPC_LINUX_PT_R19 19
89b725ae77Skettenis #define PPC_LINUX_PT_R20 20
90b725ae77Skettenis #define PPC_LINUX_PT_R21 21
91b725ae77Skettenis #define PPC_LINUX_PT_R22 22
92b725ae77Skettenis #define PPC_LINUX_PT_R23 23
93b725ae77Skettenis #define PPC_LINUX_PT_R24 24
94b725ae77Skettenis #define PPC_LINUX_PT_R25 25
95b725ae77Skettenis #define PPC_LINUX_PT_R26 26
96b725ae77Skettenis #define PPC_LINUX_PT_R27 27
97b725ae77Skettenis #define PPC_LINUX_PT_R28 28
98b725ae77Skettenis #define PPC_LINUX_PT_R29 29
99b725ae77Skettenis #define PPC_LINUX_PT_R30 30
100b725ae77Skettenis #define PPC_LINUX_PT_R31 31
101b725ae77Skettenis #define PPC_LINUX_PT_NIP 32
102b725ae77Skettenis #define PPC_LINUX_PT_MSR 33
103b725ae77Skettenis #define PPC_LINUX_PT_CTR 35
104b725ae77Skettenis #define PPC_LINUX_PT_LNK 36
105b725ae77Skettenis #define PPC_LINUX_PT_XER 37
106b725ae77Skettenis #define PPC_LINUX_PT_CCR 38
107b725ae77Skettenis #define PPC_LINUX_PT_MQ 39
108b725ae77Skettenis #define PPC_LINUX_PT_FPR0 48 /* each FP reg occupies 2 slots in this space */
109b725ae77Skettenis #define PPC_LINUX_PT_FPR31 (PPC_LINUX_PT_FPR0 + 2*31)
110b725ae77Skettenis #define PPC_LINUX_PT_FPSCR (PPC_LINUX_PT_FPR0 + 2*32 + 1)
111b725ae77Skettenis
112b725ae77Skettenis static int ppc_linux_at_sigtramp_return_path (CORE_ADDR pc);
113b725ae77Skettenis
114b725ae77Skettenis /* Determine if pc is in a signal trampoline...
115b725ae77Skettenis
116b725ae77Skettenis Ha! That's not what this does at all. wait_for_inferior in
117*11efff7fSkettenis infrun.c calls get_frame_type() in order to detect entry into a
118b725ae77Skettenis signal trampoline just after delivery of a signal. But on
119b725ae77Skettenis GNU/Linux, signal trampolines are used for the return path only.
120b725ae77Skettenis The kernel sets things up so that the signal handler is called
121b725ae77Skettenis directly.
122b725ae77Skettenis
123b725ae77Skettenis If we use in_sigtramp2() in place of in_sigtramp() (see below)
124b725ae77Skettenis we'll (often) end up with stop_pc in the trampoline and prev_pc in
125b725ae77Skettenis the (now exited) handler. The code there will cause a temporary
126b725ae77Skettenis breakpoint to be set on prev_pc which is not very likely to get hit
127b725ae77Skettenis again.
128b725ae77Skettenis
129b725ae77Skettenis If this is confusing, think of it this way... the code in
130b725ae77Skettenis wait_for_inferior() needs to be able to detect entry into a signal
131b725ae77Skettenis trampoline just after a signal is delivered, not after the handler
132b725ae77Skettenis has been run.
133b725ae77Skettenis
134b725ae77Skettenis So, we define in_sigtramp() below to return 1 if the following is
135b725ae77Skettenis true:
136b725ae77Skettenis
137b725ae77Skettenis 1) The previous frame is a real signal trampoline.
138b725ae77Skettenis
139b725ae77Skettenis - and -
140b725ae77Skettenis
141b725ae77Skettenis 2) pc is at the first or second instruction of the corresponding
142b725ae77Skettenis handler.
143b725ae77Skettenis
144b725ae77Skettenis Why the second instruction? It seems that wait_for_inferior()
145b725ae77Skettenis never sees the first instruction when single stepping. When a
146b725ae77Skettenis signal is delivered while stepping, the next instruction that
147b725ae77Skettenis would've been stepped over isn't, instead a signal is delivered and
148b725ae77Skettenis the first instruction of the handler is stepped over instead. That
149*11efff7fSkettenis puts us on the second instruction. (I added the test for the first
150*11efff7fSkettenis instruction long after the fact, just in case the observed behavior
151*11efff7fSkettenis is ever fixed.) */
152b725ae77Skettenis
153b725ae77Skettenis int
ppc_linux_in_sigtramp(CORE_ADDR pc,char * func_name)154b725ae77Skettenis ppc_linux_in_sigtramp (CORE_ADDR pc, char *func_name)
155b725ae77Skettenis {
156b725ae77Skettenis CORE_ADDR lr;
157b725ae77Skettenis CORE_ADDR sp;
158b725ae77Skettenis CORE_ADDR tramp_sp;
159b725ae77Skettenis char buf[4];
160b725ae77Skettenis CORE_ADDR handler;
161b725ae77Skettenis
162b725ae77Skettenis lr = read_register (gdbarch_tdep (current_gdbarch)->ppc_lr_regnum);
163b725ae77Skettenis if (!ppc_linux_at_sigtramp_return_path (lr))
164b725ae77Skettenis return 0;
165b725ae77Skettenis
166b725ae77Skettenis sp = read_register (SP_REGNUM);
167b725ae77Skettenis
168b725ae77Skettenis if (target_read_memory (sp, buf, sizeof (buf)) != 0)
169b725ae77Skettenis return 0;
170b725ae77Skettenis
171b725ae77Skettenis tramp_sp = extract_unsigned_integer (buf, 4);
172b725ae77Skettenis
173b725ae77Skettenis if (target_read_memory (tramp_sp + PPC_LINUX_HANDLER_PTR_OFFSET, buf,
174b725ae77Skettenis sizeof (buf)) != 0)
175b725ae77Skettenis return 0;
176b725ae77Skettenis
177b725ae77Skettenis handler = extract_unsigned_integer (buf, 4);
178b725ae77Skettenis
179b725ae77Skettenis return (pc == handler || pc == handler + 4);
180b725ae77Skettenis }
181b725ae77Skettenis
182b725ae77Skettenis static int
insn_is_sigreturn(unsigned long pcinsn)183b725ae77Skettenis insn_is_sigreturn (unsigned long pcinsn)
184b725ae77Skettenis {
185b725ae77Skettenis switch(pcinsn)
186b725ae77Skettenis {
187b725ae77Skettenis case INSTR_LI_R0_0x6666:
188b725ae77Skettenis case INSTR_LI_R0_0x7777:
189b725ae77Skettenis case INSTR_LI_R0_NR_sigreturn:
190b725ae77Skettenis case INSTR_LI_R0_NR_rt_sigreturn:
191b725ae77Skettenis return 1;
192b725ae77Skettenis default:
193b725ae77Skettenis return 0;
194b725ae77Skettenis }
195b725ae77Skettenis }
196b725ae77Skettenis
197b725ae77Skettenis /*
198b725ae77Skettenis * The signal handler trampoline is on the stack and consists of exactly
199b725ae77Skettenis * two instructions. The easiest and most accurate way of determining
200b725ae77Skettenis * whether the pc is in one of these trampolines is by inspecting the
201b725ae77Skettenis * instructions. It'd be faster though if we could find a way to do this
202b725ae77Skettenis * via some simple address comparisons.
203b725ae77Skettenis */
204b725ae77Skettenis static int
ppc_linux_at_sigtramp_return_path(CORE_ADDR pc)205b725ae77Skettenis ppc_linux_at_sigtramp_return_path (CORE_ADDR pc)
206b725ae77Skettenis {
207b725ae77Skettenis char buf[12];
208b725ae77Skettenis unsigned long pcinsn;
209b725ae77Skettenis if (target_read_memory (pc - 4, buf, sizeof (buf)) != 0)
210b725ae77Skettenis return 0;
211b725ae77Skettenis
212b725ae77Skettenis /* extract the instruction at the pc */
213b725ae77Skettenis pcinsn = extract_unsigned_integer (buf + 4, 4);
214b725ae77Skettenis
215b725ae77Skettenis return (
216b725ae77Skettenis (insn_is_sigreturn (pcinsn)
217b725ae77Skettenis && extract_unsigned_integer (buf + 8, 4) == INSTR_SC)
218b725ae77Skettenis ||
219b725ae77Skettenis (pcinsn == INSTR_SC
220b725ae77Skettenis && insn_is_sigreturn (extract_unsigned_integer (buf, 4))));
221b725ae77Skettenis }
222b725ae77Skettenis
223b725ae77Skettenis static CORE_ADDR
ppc_linux_skip_trampoline_code(CORE_ADDR pc)224b725ae77Skettenis ppc_linux_skip_trampoline_code (CORE_ADDR pc)
225b725ae77Skettenis {
226b725ae77Skettenis char buf[4];
227b725ae77Skettenis struct obj_section *sect;
228b725ae77Skettenis struct objfile *objfile;
229b725ae77Skettenis unsigned long insn;
230b725ae77Skettenis CORE_ADDR plt_start = 0;
231b725ae77Skettenis CORE_ADDR symtab = 0;
232b725ae77Skettenis CORE_ADDR strtab = 0;
233b725ae77Skettenis int num_slots = -1;
234b725ae77Skettenis int reloc_index = -1;
235b725ae77Skettenis CORE_ADDR plt_table;
236b725ae77Skettenis CORE_ADDR reloc;
237b725ae77Skettenis CORE_ADDR sym;
238b725ae77Skettenis long symidx;
239b725ae77Skettenis char symname[1024];
240b725ae77Skettenis struct minimal_symbol *msymbol;
241b725ae77Skettenis
242b725ae77Skettenis /* Find the section pc is in; return if not in .plt */
243b725ae77Skettenis sect = find_pc_section (pc);
244b725ae77Skettenis if (!sect || strcmp (sect->the_bfd_section->name, ".plt") != 0)
245b725ae77Skettenis return 0;
246b725ae77Skettenis
247b725ae77Skettenis objfile = sect->objfile;
248b725ae77Skettenis
249b725ae77Skettenis /* Pick up the instruction at pc. It had better be of the
250b725ae77Skettenis form
251b725ae77Skettenis li r11, IDX
252b725ae77Skettenis
253b725ae77Skettenis where IDX is an index into the plt_table. */
254b725ae77Skettenis
255b725ae77Skettenis if (target_read_memory (pc, buf, 4) != 0)
256b725ae77Skettenis return 0;
257b725ae77Skettenis insn = extract_unsigned_integer (buf, 4);
258b725ae77Skettenis
259b725ae77Skettenis if ((insn & 0xffff0000) != 0x39600000 /* li r11, VAL */ )
260b725ae77Skettenis return 0;
261b725ae77Skettenis
262b725ae77Skettenis reloc_index = (insn << 16) >> 16;
263b725ae77Skettenis
264b725ae77Skettenis /* Find the objfile that pc is in and obtain the information
265b725ae77Skettenis necessary for finding the symbol name. */
266b725ae77Skettenis for (sect = objfile->sections; sect < objfile->sections_end; ++sect)
267b725ae77Skettenis {
268b725ae77Skettenis const char *secname = sect->the_bfd_section->name;
269b725ae77Skettenis if (strcmp (secname, ".plt") == 0)
270b725ae77Skettenis plt_start = sect->addr;
271b725ae77Skettenis else if (strcmp (secname, ".rela.plt") == 0)
272b725ae77Skettenis num_slots = ((int) sect->endaddr - (int) sect->addr) / 12;
273b725ae77Skettenis else if (strcmp (secname, ".dynsym") == 0)
274b725ae77Skettenis symtab = sect->addr;
275b725ae77Skettenis else if (strcmp (secname, ".dynstr") == 0)
276b725ae77Skettenis strtab = sect->addr;
277b725ae77Skettenis }
278b725ae77Skettenis
279b725ae77Skettenis /* Make sure we have all the information we need. */
280b725ae77Skettenis if (plt_start == 0 || num_slots == -1 || symtab == 0 || strtab == 0)
281b725ae77Skettenis return 0;
282b725ae77Skettenis
283b725ae77Skettenis /* Compute the value of the plt table */
284b725ae77Skettenis plt_table = plt_start + 72 + 8 * num_slots;
285b725ae77Skettenis
286b725ae77Skettenis /* Get address of the relocation entry (Elf32_Rela) */
287b725ae77Skettenis if (target_read_memory (plt_table + reloc_index, buf, 4) != 0)
288b725ae77Skettenis return 0;
289b725ae77Skettenis reloc = extract_unsigned_integer (buf, 4);
290b725ae77Skettenis
291b725ae77Skettenis sect = find_pc_section (reloc);
292b725ae77Skettenis if (!sect)
293b725ae77Skettenis return 0;
294b725ae77Skettenis
295b725ae77Skettenis if (strcmp (sect->the_bfd_section->name, ".text") == 0)
296b725ae77Skettenis return reloc;
297b725ae77Skettenis
298b725ae77Skettenis /* Now get the r_info field which is the relocation type and symbol
299b725ae77Skettenis index. */
300b725ae77Skettenis if (target_read_memory (reloc + 4, buf, 4) != 0)
301b725ae77Skettenis return 0;
302b725ae77Skettenis symidx = extract_unsigned_integer (buf, 4);
303b725ae77Skettenis
304b725ae77Skettenis /* Shift out the relocation type leaving just the symbol index */
305b725ae77Skettenis /* symidx = ELF32_R_SYM(symidx); */
306b725ae77Skettenis symidx = symidx >> 8;
307b725ae77Skettenis
308b725ae77Skettenis /* compute the address of the symbol */
309b725ae77Skettenis sym = symtab + symidx * 4;
310b725ae77Skettenis
311b725ae77Skettenis /* Fetch the string table index */
312b725ae77Skettenis if (target_read_memory (sym, buf, 4) != 0)
313b725ae77Skettenis return 0;
314b725ae77Skettenis symidx = extract_unsigned_integer (buf, 4);
315b725ae77Skettenis
316b725ae77Skettenis /* Fetch the string; we don't know how long it is. Is it possible
317b725ae77Skettenis that the following will fail because we're trying to fetch too
318b725ae77Skettenis much? */
319b725ae77Skettenis if (target_read_memory (strtab + symidx, symname, sizeof (symname)) != 0)
320b725ae77Skettenis return 0;
321b725ae77Skettenis
322b725ae77Skettenis /* This might not work right if we have multiple symbols with the
323b725ae77Skettenis same name; the only way to really get it right is to perform
324b725ae77Skettenis the same sort of lookup as the dynamic linker. */
325b725ae77Skettenis msymbol = lookup_minimal_symbol_text (symname, NULL);
326b725ae77Skettenis if (!msymbol)
327b725ae77Skettenis return 0;
328b725ae77Skettenis
329b725ae77Skettenis return SYMBOL_VALUE_ADDRESS (msymbol);
330b725ae77Skettenis }
331b725ae77Skettenis
332b725ae77Skettenis /* ppc_linux_memory_remove_breakpoints attempts to remove a breakpoint
333b725ae77Skettenis in much the same fashion as memory_remove_breakpoint in mem-break.c,
334b725ae77Skettenis but is careful not to write back the previous contents if the code
335b725ae77Skettenis in question has changed in between inserting the breakpoint and
336b725ae77Skettenis removing it.
337b725ae77Skettenis
338b725ae77Skettenis Here is the problem that we're trying to solve...
339b725ae77Skettenis
340b725ae77Skettenis Once upon a time, before introducing this function to remove
341b725ae77Skettenis breakpoints from the inferior, setting a breakpoint on a shared
342b725ae77Skettenis library function prior to running the program would not work
343b725ae77Skettenis properly. In order to understand the problem, it is first
344b725ae77Skettenis necessary to understand a little bit about dynamic linking on
345b725ae77Skettenis this platform.
346b725ae77Skettenis
347b725ae77Skettenis A call to a shared library function is accomplished via a bl
348b725ae77Skettenis (branch-and-link) instruction whose branch target is an entry
349b725ae77Skettenis in the procedure linkage table (PLT). The PLT in the object
350b725ae77Skettenis file is uninitialized. To gdb, prior to running the program, the
351b725ae77Skettenis entries in the PLT are all zeros.
352b725ae77Skettenis
353b725ae77Skettenis Once the program starts running, the shared libraries are loaded
354b725ae77Skettenis and the procedure linkage table is initialized, but the entries in
355b725ae77Skettenis the table are not (necessarily) resolved. Once a function is
356b725ae77Skettenis actually called, the code in the PLT is hit and the function is
357b725ae77Skettenis resolved. In order to better illustrate this, an example is in
358b725ae77Skettenis order; the following example is from the gdb testsuite.
359b725ae77Skettenis
360b725ae77Skettenis We start the program shmain.
361b725ae77Skettenis
362b725ae77Skettenis [kev@arroyo testsuite]$ ../gdb gdb.base/shmain
363b725ae77Skettenis [...]
364b725ae77Skettenis
365b725ae77Skettenis We place two breakpoints, one on shr1 and the other on main.
366b725ae77Skettenis
367b725ae77Skettenis (gdb) b shr1
368b725ae77Skettenis Breakpoint 1 at 0x100409d4
369b725ae77Skettenis (gdb) b main
370b725ae77Skettenis Breakpoint 2 at 0x100006a0: file gdb.base/shmain.c, line 44.
371b725ae77Skettenis
372b725ae77Skettenis Examine the instruction (and the immediatly following instruction)
373b725ae77Skettenis upon which the breakpoint was placed. Note that the PLT entry
374b725ae77Skettenis for shr1 contains zeros.
375b725ae77Skettenis
376b725ae77Skettenis (gdb) x/2i 0x100409d4
377b725ae77Skettenis 0x100409d4 <shr1>: .long 0x0
378b725ae77Skettenis 0x100409d8 <shr1+4>: .long 0x0
379b725ae77Skettenis
380b725ae77Skettenis Now run 'til main.
381b725ae77Skettenis
382b725ae77Skettenis (gdb) r
383b725ae77Skettenis Starting program: gdb.base/shmain
384b725ae77Skettenis Breakpoint 1 at 0xffaf790: file gdb.base/shr1.c, line 19.
385b725ae77Skettenis
386b725ae77Skettenis Breakpoint 2, main ()
387b725ae77Skettenis at gdb.base/shmain.c:44
388b725ae77Skettenis 44 g = 1;
389b725ae77Skettenis
390b725ae77Skettenis Examine the PLT again. Note that the loading of the shared
391b725ae77Skettenis library has initialized the PLT to code which loads a constant
392b725ae77Skettenis (which I think is an index into the GOT) into r11 and then
393b725ae77Skettenis branchs a short distance to the code which actually does the
394b725ae77Skettenis resolving.
395b725ae77Skettenis
396b725ae77Skettenis (gdb) x/2i 0x100409d4
397b725ae77Skettenis 0x100409d4 <shr1>: li r11,4
398b725ae77Skettenis 0x100409d8 <shr1+4>: b 0x10040984 <sg+4>
399b725ae77Skettenis (gdb) c
400b725ae77Skettenis Continuing.
401b725ae77Skettenis
402b725ae77Skettenis Breakpoint 1, shr1 (x=1)
403b725ae77Skettenis at gdb.base/shr1.c:19
404b725ae77Skettenis 19 l = 1;
405b725ae77Skettenis
406b725ae77Skettenis Now we've hit the breakpoint at shr1. (The breakpoint was
407b725ae77Skettenis reset from the PLT entry to the actual shr1 function after the
408b725ae77Skettenis shared library was loaded.) Note that the PLT entry has been
409b725ae77Skettenis resolved to contain a branch that takes us directly to shr1.
410b725ae77Skettenis (The real one, not the PLT entry.)
411b725ae77Skettenis
412b725ae77Skettenis (gdb) x/2i 0x100409d4
413b725ae77Skettenis 0x100409d4 <shr1>: b 0xffaf76c <shr1>
414b725ae77Skettenis 0x100409d8 <shr1+4>: b 0x10040984 <sg+4>
415b725ae77Skettenis
416b725ae77Skettenis The thing to note here is that the PLT entry for shr1 has been
417b725ae77Skettenis changed twice.
418b725ae77Skettenis
419b725ae77Skettenis Now the problem should be obvious. GDB places a breakpoint (a
420b725ae77Skettenis trap instruction) on the zero value of the PLT entry for shr1.
421b725ae77Skettenis Later on, after the shared library had been loaded and the PLT
422b725ae77Skettenis initialized, GDB gets a signal indicating this fact and attempts
423b725ae77Skettenis (as it always does when it stops) to remove all the breakpoints.
424b725ae77Skettenis
425b725ae77Skettenis The breakpoint removal was causing the former contents (a zero
426b725ae77Skettenis word) to be written back to the now initialized PLT entry thus
427b725ae77Skettenis destroying a portion of the initialization that had occurred only a
428b725ae77Skettenis short time ago. When execution continued, the zero word would be
429b725ae77Skettenis executed as an instruction an an illegal instruction trap was
430b725ae77Skettenis generated instead. (0 is not a legal instruction.)
431b725ae77Skettenis
432b725ae77Skettenis The fix for this problem was fairly straightforward. The function
433b725ae77Skettenis memory_remove_breakpoint from mem-break.c was copied to this file,
434b725ae77Skettenis modified slightly, and renamed to ppc_linux_memory_remove_breakpoint.
435b725ae77Skettenis In tm-linux.h, MEMORY_REMOVE_BREAKPOINT is defined to call this new
436b725ae77Skettenis function.
437b725ae77Skettenis
438b725ae77Skettenis The differences between ppc_linux_memory_remove_breakpoint () and
439b725ae77Skettenis memory_remove_breakpoint () are minor. All that the former does
440b725ae77Skettenis that the latter does not is check to make sure that the breakpoint
441b725ae77Skettenis location actually contains a breakpoint (trap instruction) prior
442b725ae77Skettenis to attempting to write back the old contents. If it does contain
443b725ae77Skettenis a trap instruction, we allow the old contents to be written back.
444b725ae77Skettenis Otherwise, we silently do nothing.
445b725ae77Skettenis
446b725ae77Skettenis The big question is whether memory_remove_breakpoint () should be
447b725ae77Skettenis changed to have the same functionality. The downside is that more
448b725ae77Skettenis traffic is generated for remote targets since we'll have an extra
449b725ae77Skettenis fetch of a memory word each time a breakpoint is removed.
450b725ae77Skettenis
451b725ae77Skettenis For the time being, we'll leave this self-modifying-code-friendly
452b725ae77Skettenis version in ppc-linux-tdep.c, but it ought to be migrated somewhere
453b725ae77Skettenis else in the event that some other platform has similar needs with
454b725ae77Skettenis regard to removing breakpoints in some potentially self modifying
455b725ae77Skettenis code. */
456b725ae77Skettenis int
ppc_linux_memory_remove_breakpoint(CORE_ADDR addr,char * contents_cache)457b725ae77Skettenis ppc_linux_memory_remove_breakpoint (CORE_ADDR addr, char *contents_cache)
458b725ae77Skettenis {
459b725ae77Skettenis const unsigned char *bp;
460b725ae77Skettenis int val;
461b725ae77Skettenis int bplen;
462b725ae77Skettenis char old_contents[BREAKPOINT_MAX];
463b725ae77Skettenis
464b725ae77Skettenis /* Determine appropriate breakpoint contents and size for this address. */
465b725ae77Skettenis bp = BREAKPOINT_FROM_PC (&addr, &bplen);
466b725ae77Skettenis if (bp == NULL)
467b725ae77Skettenis error ("Software breakpoints not implemented for this target.");
468b725ae77Skettenis
469b725ae77Skettenis val = target_read_memory (addr, old_contents, bplen);
470b725ae77Skettenis
471b725ae77Skettenis /* If our breakpoint is no longer at the address, this means that the
472b725ae77Skettenis program modified the code on us, so it is wrong to put back the
473b725ae77Skettenis old value */
474b725ae77Skettenis if (val == 0 && memcmp (bp, old_contents, bplen) == 0)
475b725ae77Skettenis val = target_write_memory (addr, contents_cache, bplen);
476b725ae77Skettenis
477b725ae77Skettenis return val;
478b725ae77Skettenis }
479b725ae77Skettenis
480b725ae77Skettenis /* For historic reasons, PPC 32 GNU/Linux follows PowerOpen rather
481b725ae77Skettenis than the 32 bit SYSV R4 ABI structure return convention - all
482b725ae77Skettenis structures, no matter their size, are put in memory. Vectors,
483b725ae77Skettenis which were added later, do get returned in a register though. */
484b725ae77Skettenis
485b725ae77Skettenis static enum return_value_convention
ppc_linux_return_value(struct gdbarch * gdbarch,struct type * valtype,struct regcache * regcache,void * readbuf,const void * writebuf)486b725ae77Skettenis ppc_linux_return_value (struct gdbarch *gdbarch, struct type *valtype,
487b725ae77Skettenis struct regcache *regcache, void *readbuf,
488b725ae77Skettenis const void *writebuf)
489b725ae77Skettenis {
490b725ae77Skettenis if ((TYPE_CODE (valtype) == TYPE_CODE_STRUCT
491b725ae77Skettenis || TYPE_CODE (valtype) == TYPE_CODE_UNION)
492b725ae77Skettenis && !((TYPE_LENGTH (valtype) == 16 || TYPE_LENGTH (valtype) == 8)
493b725ae77Skettenis && TYPE_VECTOR (valtype)))
494b725ae77Skettenis return RETURN_VALUE_STRUCT_CONVENTION;
495b725ae77Skettenis else
496b725ae77Skettenis return ppc_sysv_abi_return_value (gdbarch, valtype, regcache, readbuf,
497b725ae77Skettenis writebuf);
498b725ae77Skettenis }
499b725ae77Skettenis
500b725ae77Skettenis /* Fetch (and possibly build) an appropriate link_map_offsets
501b725ae77Skettenis structure for GNU/Linux PPC targets using the struct offsets
502b725ae77Skettenis defined in link.h (but without actual reference to that file).
503b725ae77Skettenis
504b725ae77Skettenis This makes it possible to access GNU/Linux PPC shared libraries
505b725ae77Skettenis from a GDB that was not built on an GNU/Linux PPC host (for cross
506b725ae77Skettenis debugging). */
507b725ae77Skettenis
508b725ae77Skettenis struct link_map_offsets *
ppc_linux_svr4_fetch_link_map_offsets(void)509b725ae77Skettenis ppc_linux_svr4_fetch_link_map_offsets (void)
510b725ae77Skettenis {
511b725ae77Skettenis static struct link_map_offsets lmo;
512b725ae77Skettenis static struct link_map_offsets *lmp = NULL;
513b725ae77Skettenis
514b725ae77Skettenis if (lmp == NULL)
515b725ae77Skettenis {
516b725ae77Skettenis lmp = &lmo;
517b725ae77Skettenis
518b725ae77Skettenis lmo.r_debug_size = 8; /* The actual size is 20 bytes, but
519b725ae77Skettenis this is all we need. */
520b725ae77Skettenis lmo.r_map_offset = 4;
521b725ae77Skettenis lmo.r_map_size = 4;
522b725ae77Skettenis
523b725ae77Skettenis lmo.link_map_size = 20; /* The actual size is 560 bytes, but
524b725ae77Skettenis this is all we need. */
525b725ae77Skettenis lmo.l_addr_offset = 0;
526b725ae77Skettenis lmo.l_addr_size = 4;
527b725ae77Skettenis
528b725ae77Skettenis lmo.l_name_offset = 4;
529b725ae77Skettenis lmo.l_name_size = 4;
530b725ae77Skettenis
531b725ae77Skettenis lmo.l_next_offset = 12;
532b725ae77Skettenis lmo.l_next_size = 4;
533b725ae77Skettenis
534b725ae77Skettenis lmo.l_prev_offset = 16;
535b725ae77Skettenis lmo.l_prev_size = 4;
536b725ae77Skettenis }
537b725ae77Skettenis
538b725ae77Skettenis return lmp;
539b725ae77Skettenis }
540b725ae77Skettenis
541b725ae77Skettenis
542b725ae77Skettenis /* Macros for matching instructions. Note that, since all the
543b725ae77Skettenis operands are masked off before they're or-ed into the instruction,
544b725ae77Skettenis you can use -1 to make masks. */
545b725ae77Skettenis
546b725ae77Skettenis #define insn_d(opcd, rts, ra, d) \
547b725ae77Skettenis ((((opcd) & 0x3f) << 26) \
548b725ae77Skettenis | (((rts) & 0x1f) << 21) \
549b725ae77Skettenis | (((ra) & 0x1f) << 16) \
550b725ae77Skettenis | ((d) & 0xffff))
551b725ae77Skettenis
552b725ae77Skettenis #define insn_ds(opcd, rts, ra, d, xo) \
553b725ae77Skettenis ((((opcd) & 0x3f) << 26) \
554b725ae77Skettenis | (((rts) & 0x1f) << 21) \
555b725ae77Skettenis | (((ra) & 0x1f) << 16) \
556b725ae77Skettenis | ((d) & 0xfffc) \
557b725ae77Skettenis | ((xo) & 0x3))
558b725ae77Skettenis
559b725ae77Skettenis #define insn_xfx(opcd, rts, spr, xo) \
560b725ae77Skettenis ((((opcd) & 0x3f) << 26) \
561b725ae77Skettenis | (((rts) & 0x1f) << 21) \
562b725ae77Skettenis | (((spr) & 0x1f) << 16) \
563b725ae77Skettenis | (((spr) & 0x3e0) << 6) \
564b725ae77Skettenis | (((xo) & 0x3ff) << 1))
565b725ae77Skettenis
566b725ae77Skettenis /* Read a PPC instruction from memory. PPC instructions are always
567b725ae77Skettenis big-endian, no matter what endianness the program is running in, so
568b725ae77Skettenis we can't use read_memory_integer or one of its friends here. */
569b725ae77Skettenis static unsigned int
read_insn(CORE_ADDR pc)570b725ae77Skettenis read_insn (CORE_ADDR pc)
571b725ae77Skettenis {
572b725ae77Skettenis unsigned char buf[4];
573b725ae77Skettenis
574b725ae77Skettenis read_memory (pc, buf, 4);
575b725ae77Skettenis return (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3];
576b725ae77Skettenis }
577b725ae77Skettenis
578b725ae77Skettenis
579b725ae77Skettenis /* An instruction to match. */
580b725ae77Skettenis struct insn_pattern
581b725ae77Skettenis {
582b725ae77Skettenis unsigned int mask; /* mask the insn with this... */
583b725ae77Skettenis unsigned int data; /* ...and see if it matches this. */
584b725ae77Skettenis int optional; /* If non-zero, this insn may be absent. */
585b725ae77Skettenis };
586b725ae77Skettenis
587b725ae77Skettenis /* Return non-zero if the instructions at PC match the series
588b725ae77Skettenis described in PATTERN, or zero otherwise. PATTERN is an array of
589b725ae77Skettenis 'struct insn_pattern' objects, terminated by an entry whose mask is
590b725ae77Skettenis zero.
591b725ae77Skettenis
592b725ae77Skettenis When the match is successful, fill INSN[i] with what PATTERN[i]
593b725ae77Skettenis matched. If PATTERN[i] is optional, and the instruction wasn't
594b725ae77Skettenis present, set INSN[i] to 0 (which is not a valid PPC instruction).
595b725ae77Skettenis INSN should have as many elements as PATTERN. Note that, if
596b725ae77Skettenis PATTERN contains optional instructions which aren't present in
597b725ae77Skettenis memory, then INSN will have holes, so INSN[i] isn't necessarily the
598b725ae77Skettenis i'th instruction in memory. */
599b725ae77Skettenis static int
insns_match_pattern(CORE_ADDR pc,struct insn_pattern * pattern,unsigned int * insn)600b725ae77Skettenis insns_match_pattern (CORE_ADDR pc,
601b725ae77Skettenis struct insn_pattern *pattern,
602b725ae77Skettenis unsigned int *insn)
603b725ae77Skettenis {
604b725ae77Skettenis int i;
605b725ae77Skettenis
606b725ae77Skettenis for (i = 0; pattern[i].mask; i++)
607b725ae77Skettenis {
608b725ae77Skettenis insn[i] = read_insn (pc);
609b725ae77Skettenis if ((insn[i] & pattern[i].mask) == pattern[i].data)
610b725ae77Skettenis pc += 4;
611b725ae77Skettenis else if (pattern[i].optional)
612b725ae77Skettenis insn[i] = 0;
613b725ae77Skettenis else
614b725ae77Skettenis return 0;
615b725ae77Skettenis }
616b725ae77Skettenis
617b725ae77Skettenis return 1;
618b725ae77Skettenis }
619b725ae77Skettenis
620b725ae77Skettenis
621b725ae77Skettenis /* Return the 'd' field of the d-form instruction INSN, properly
622b725ae77Skettenis sign-extended. */
623b725ae77Skettenis static CORE_ADDR
insn_d_field(unsigned int insn)624b725ae77Skettenis insn_d_field (unsigned int insn)
625b725ae77Skettenis {
626b725ae77Skettenis return ((((CORE_ADDR) insn & 0xffff) ^ 0x8000) - 0x8000);
627b725ae77Skettenis }
628b725ae77Skettenis
629b725ae77Skettenis
630b725ae77Skettenis /* Return the 'ds' field of the ds-form instruction INSN, with the two
631b725ae77Skettenis zero bits concatenated at the right, and properly
632b725ae77Skettenis sign-extended. */
633b725ae77Skettenis static CORE_ADDR
insn_ds_field(unsigned int insn)634b725ae77Skettenis insn_ds_field (unsigned int insn)
635b725ae77Skettenis {
636b725ae77Skettenis return ((((CORE_ADDR) insn & 0xfffc) ^ 0x8000) - 0x8000);
637b725ae77Skettenis }
638b725ae77Skettenis
639b725ae77Skettenis
640b725ae77Skettenis /* If DESC is the address of a 64-bit PowerPC GNU/Linux function
641b725ae77Skettenis descriptor, return the descriptor's entry point. */
642b725ae77Skettenis static CORE_ADDR
ppc64_desc_entry_point(CORE_ADDR desc)643b725ae77Skettenis ppc64_desc_entry_point (CORE_ADDR desc)
644b725ae77Skettenis {
645b725ae77Skettenis /* The first word of the descriptor is the entry point. */
646b725ae77Skettenis return (CORE_ADDR) read_memory_unsigned_integer (desc, 8);
647b725ae77Skettenis }
648b725ae77Skettenis
649b725ae77Skettenis
650b725ae77Skettenis /* Pattern for the standard linkage function. These are built by
651b725ae77Skettenis build_plt_stub in elf64-ppc.c, whose GLINK argument is always
652b725ae77Skettenis zero. */
653b725ae77Skettenis static struct insn_pattern ppc64_standard_linkage[] =
654b725ae77Skettenis {
655b725ae77Skettenis /* addis r12, r2, <any> */
656b725ae77Skettenis { insn_d (-1, -1, -1, 0), insn_d (15, 12, 2, 0), 0 },
657b725ae77Skettenis
658b725ae77Skettenis /* std r2, 40(r1) */
659b725ae77Skettenis { -1, insn_ds (62, 2, 1, 40, 0), 0 },
660b725ae77Skettenis
661b725ae77Skettenis /* ld r11, <any>(r12) */
662b725ae77Skettenis { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 12, 0, 0), 0 },
663b725ae77Skettenis
664b725ae77Skettenis /* addis r12, r12, 1 <optional> */
665b725ae77Skettenis { insn_d (-1, -1, -1, -1), insn_d (15, 12, 2, 1), 1 },
666b725ae77Skettenis
667b725ae77Skettenis /* ld r2, <any>(r12) */
668b725ae77Skettenis { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 2, 12, 0, 0), 0 },
669b725ae77Skettenis
670b725ae77Skettenis /* addis r12, r12, 1 <optional> */
671b725ae77Skettenis { insn_d (-1, -1, -1, -1), insn_d (15, 12, 2, 1), 1 },
672b725ae77Skettenis
673b725ae77Skettenis /* mtctr r11 */
674b725ae77Skettenis { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 11, 9, 467),
675b725ae77Skettenis 0 },
676b725ae77Skettenis
677b725ae77Skettenis /* ld r11, <any>(r12) */
678b725ae77Skettenis { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 12, 0, 0), 0 },
679b725ae77Skettenis
680b725ae77Skettenis /* bctr */
681b725ae77Skettenis { -1, 0x4e800420, 0 },
682b725ae77Skettenis
683b725ae77Skettenis { 0, 0, 0 }
684b725ae77Skettenis };
685b725ae77Skettenis #define PPC64_STANDARD_LINKAGE_LEN \
686b725ae77Skettenis (sizeof (ppc64_standard_linkage) / sizeof (ppc64_standard_linkage[0]))
687b725ae77Skettenis
688b725ae77Skettenis
689b725ae77Skettenis /* Recognize a 64-bit PowerPC GNU/Linux linkage function --- what GDB
690b725ae77Skettenis calls a "solib trampoline". */
691b725ae77Skettenis static int
ppc64_in_solib_call_trampoline(CORE_ADDR pc,char * name)692b725ae77Skettenis ppc64_in_solib_call_trampoline (CORE_ADDR pc, char *name)
693b725ae77Skettenis {
694b725ae77Skettenis /* Detecting solib call trampolines on PPC64 GNU/Linux is a pain.
695b725ae77Skettenis
696b725ae77Skettenis It's not specifically solib call trampolines that are the issue.
697b725ae77Skettenis Any call from one function to another function that uses a
698b725ae77Skettenis different TOC requires a trampoline, to save the caller's TOC
699b725ae77Skettenis pointer and then load the callee's TOC. An executable or shared
700b725ae77Skettenis library may have more than one TOC, so even intra-object calls
701b725ae77Skettenis may require a trampoline. Since executable and shared libraries
702b725ae77Skettenis will all have their own distinct TOCs, every inter-object call is
703b725ae77Skettenis also an inter-TOC call, and requires a trampoline --- so "solib
704b725ae77Skettenis call trampolines" are just a special case.
705b725ae77Skettenis
706b725ae77Skettenis The 64-bit PowerPC GNU/Linux ABI calls these call trampolines
707b725ae77Skettenis "linkage functions". Since they need to be near the functions
708b725ae77Skettenis that call them, they all appear in .text, not in any special
709b725ae77Skettenis section. The .plt section just contains an array of function
710b725ae77Skettenis descriptors, from which the linkage functions load the callee's
711b725ae77Skettenis entry point, TOC value, and environment pointer. So
712b725ae77Skettenis in_plt_section is useless. The linkage functions don't have any
713b725ae77Skettenis special linker symbols to name them, either.
714b725ae77Skettenis
715b725ae77Skettenis The only way I can see to recognize them is to actually look at
716b725ae77Skettenis their code. They're generated by ppc_build_one_stub and some
717b725ae77Skettenis other functions in bfd/elf64-ppc.c, so that should show us all
718b725ae77Skettenis the instruction sequences we need to recognize. */
719b725ae77Skettenis unsigned int insn[PPC64_STANDARD_LINKAGE_LEN];
720b725ae77Skettenis
721b725ae77Skettenis return insns_match_pattern (pc, ppc64_standard_linkage, insn);
722b725ae77Skettenis }
723b725ae77Skettenis
724b725ae77Skettenis
725b725ae77Skettenis /* When the dynamic linker is doing lazy symbol resolution, the first
726b725ae77Skettenis call to a function in another object will go like this:
727b725ae77Skettenis
728b725ae77Skettenis - The user's function calls the linkage function:
729b725ae77Skettenis
730b725ae77Skettenis 100007c4: 4b ff fc d5 bl 10000498
731b725ae77Skettenis 100007c8: e8 41 00 28 ld r2,40(r1)
732b725ae77Skettenis
733b725ae77Skettenis - The linkage function loads the entry point (and other stuff) from
734b725ae77Skettenis the function descriptor in the PLT, and jumps to it:
735b725ae77Skettenis
736b725ae77Skettenis 10000498: 3d 82 00 00 addis r12,r2,0
737b725ae77Skettenis 1000049c: f8 41 00 28 std r2,40(r1)
738b725ae77Skettenis 100004a0: e9 6c 80 98 ld r11,-32616(r12)
739b725ae77Skettenis 100004a4: e8 4c 80 a0 ld r2,-32608(r12)
740b725ae77Skettenis 100004a8: 7d 69 03 a6 mtctr r11
741b725ae77Skettenis 100004ac: e9 6c 80 a8 ld r11,-32600(r12)
742b725ae77Skettenis 100004b0: 4e 80 04 20 bctr
743b725ae77Skettenis
744b725ae77Skettenis - But since this is the first time that PLT entry has been used, it
745b725ae77Skettenis sends control to its glink entry. That loads the number of the
746b725ae77Skettenis PLT entry and jumps to the common glink0 code:
747b725ae77Skettenis
748b725ae77Skettenis 10000c98: 38 00 00 00 li r0,0
749b725ae77Skettenis 10000c9c: 4b ff ff dc b 10000c78
750b725ae77Skettenis
751b725ae77Skettenis - The common glink0 code then transfers control to the dynamic
752b725ae77Skettenis linker's fixup code:
753b725ae77Skettenis
754b725ae77Skettenis 10000c78: e8 41 00 28 ld r2,40(r1)
755b725ae77Skettenis 10000c7c: 3d 82 00 00 addis r12,r2,0
756b725ae77Skettenis 10000c80: e9 6c 80 80 ld r11,-32640(r12)
757b725ae77Skettenis 10000c84: e8 4c 80 88 ld r2,-32632(r12)
758b725ae77Skettenis 10000c88: 7d 69 03 a6 mtctr r11
759b725ae77Skettenis 10000c8c: e9 6c 80 90 ld r11,-32624(r12)
760b725ae77Skettenis 10000c90: 4e 80 04 20 bctr
761b725ae77Skettenis
762b725ae77Skettenis Eventually, this code will figure out how to skip all of this,
763b725ae77Skettenis including the dynamic linker. At the moment, we just get through
764b725ae77Skettenis the linkage function. */
765b725ae77Skettenis
766b725ae77Skettenis /* If the current thread is about to execute a series of instructions
767b725ae77Skettenis at PC matching the ppc64_standard_linkage pattern, and INSN is the result
768b725ae77Skettenis from that pattern match, return the code address to which the
769b725ae77Skettenis standard linkage function will send them. (This doesn't deal with
770b725ae77Skettenis dynamic linker lazy symbol resolution stubs.) */
771b725ae77Skettenis static CORE_ADDR
ppc64_standard_linkage_target(CORE_ADDR pc,unsigned int * insn)772b725ae77Skettenis ppc64_standard_linkage_target (CORE_ADDR pc, unsigned int *insn)
773b725ae77Skettenis {
774b725ae77Skettenis struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
775b725ae77Skettenis
776b725ae77Skettenis /* The address of the function descriptor this linkage function
777b725ae77Skettenis references. */
778b725ae77Skettenis CORE_ADDR desc
779b725ae77Skettenis = ((CORE_ADDR) read_register (tdep->ppc_gp0_regnum + 2)
780b725ae77Skettenis + (insn_d_field (insn[0]) << 16)
781b725ae77Skettenis + insn_ds_field (insn[2]));
782b725ae77Skettenis
783b725ae77Skettenis /* The first word of the descriptor is the entry point. Return that. */
784b725ae77Skettenis return ppc64_desc_entry_point (desc);
785b725ae77Skettenis }
786b725ae77Skettenis
787b725ae77Skettenis
788b725ae77Skettenis /* Given that we've begun executing a call trampoline at PC, return
789b725ae77Skettenis the entry point of the function the trampoline will go to. */
790b725ae77Skettenis static CORE_ADDR
ppc64_skip_trampoline_code(CORE_ADDR pc)791b725ae77Skettenis ppc64_skip_trampoline_code (CORE_ADDR pc)
792b725ae77Skettenis {
793b725ae77Skettenis unsigned int ppc64_standard_linkage_insn[PPC64_STANDARD_LINKAGE_LEN];
794b725ae77Skettenis
795b725ae77Skettenis if (insns_match_pattern (pc, ppc64_standard_linkage,
796b725ae77Skettenis ppc64_standard_linkage_insn))
797b725ae77Skettenis return ppc64_standard_linkage_target (pc, ppc64_standard_linkage_insn);
798b725ae77Skettenis else
799b725ae77Skettenis return 0;
800b725ae77Skettenis }
801b725ae77Skettenis
802b725ae77Skettenis
803b725ae77Skettenis /* Support for CONVERT_FROM_FUNC_PTR_ADDR (ARCH, ADDR, TARG) on PPC64
804b725ae77Skettenis GNU/Linux.
805b725ae77Skettenis
806b725ae77Skettenis Usually a function pointer's representation is simply the address
807b725ae77Skettenis of the function. On GNU/Linux on the 64-bit PowerPC however, a
808b725ae77Skettenis function pointer is represented by a pointer to a TOC entry. This
809b725ae77Skettenis TOC entry contains three words, the first word is the address of
810b725ae77Skettenis the function, the second word is the TOC pointer (r2), and the
811b725ae77Skettenis third word is the static chain value. Throughout GDB it is
812b725ae77Skettenis currently assumed that a function pointer contains the address of
813b725ae77Skettenis the function, which is not easy to fix. In addition, the
814b725ae77Skettenis conversion of a function address to a function pointer would
815b725ae77Skettenis require allocation of a TOC entry in the inferior's memory space,
816b725ae77Skettenis with all its drawbacks. To be able to call C++ virtual methods in
817b725ae77Skettenis the inferior (which are called via function pointers),
818b725ae77Skettenis find_function_addr uses this function to get the function address
819b725ae77Skettenis from a function pointer. */
820b725ae77Skettenis
821b725ae77Skettenis /* If ADDR points at what is clearly a function descriptor, transform
822b725ae77Skettenis it into the address of the corresponding function. Be
823b725ae77Skettenis conservative, otherwize GDB will do the transformation on any
824b725ae77Skettenis random addresses such as occures when there is no symbol table. */
825b725ae77Skettenis
826b725ae77Skettenis static CORE_ADDR
ppc64_linux_convert_from_func_ptr_addr(struct gdbarch * gdbarch,CORE_ADDR addr,struct target_ops * targ)827b725ae77Skettenis ppc64_linux_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
828b725ae77Skettenis CORE_ADDR addr,
829b725ae77Skettenis struct target_ops *targ)
830b725ae77Skettenis {
831b725ae77Skettenis struct section_table *s = target_section_by_addr (targ, addr);
832b725ae77Skettenis
833b725ae77Skettenis /* Check if ADDR points to a function descriptor. */
834b725ae77Skettenis if (s && strcmp (s->the_bfd_section->name, ".opd") == 0)
835b725ae77Skettenis return get_target_memory_unsigned (targ, addr, 8);
836b725ae77Skettenis
837b725ae77Skettenis return addr;
838b725ae77Skettenis }
839b725ae77Skettenis
840*11efff7fSkettenis static void
right_supply_register(struct regcache * regcache,int wordsize,int regnum,const bfd_byte * buf)841*11efff7fSkettenis right_supply_register (struct regcache *regcache, int wordsize, int regnum,
842*11efff7fSkettenis const bfd_byte *buf)
843b725ae77Skettenis {
844*11efff7fSkettenis regcache_raw_supply (regcache, regnum,
845*11efff7fSkettenis (buf + wordsize - register_size (current_gdbarch, regnum)));
846b725ae77Skettenis }
847b725ae77Skettenis
848*11efff7fSkettenis /* Extract the register values found in the WORDSIZED ABI GREGSET,
849*11efff7fSkettenis storing their values in REGCACHE. Note that some are left-aligned,
850*11efff7fSkettenis while others are right aligned. */
851*11efff7fSkettenis
852b725ae77Skettenis void
ppc_linux_supply_gregset(struct regcache * regcache,int regnum,const void * gregs,size_t size,int wordsize)853*11efff7fSkettenis ppc_linux_supply_gregset (struct regcache *regcache,
854*11efff7fSkettenis int regnum, const void *gregs, size_t size,
855*11efff7fSkettenis int wordsize)
856b725ae77Skettenis {
857b725ae77Skettenis int regi;
858*11efff7fSkettenis struct gdbarch *regcache_arch = get_regcache_arch (regcache);
859*11efff7fSkettenis struct gdbarch_tdep *regcache_tdep = gdbarch_tdep (regcache_arch);
860*11efff7fSkettenis const bfd_byte *buf = gregs;
861b725ae77Skettenis
862*11efff7fSkettenis for (regi = 0; regi < ppc_num_gprs; regi++)
863*11efff7fSkettenis right_supply_register (regcache, wordsize,
864*11efff7fSkettenis regcache_tdep->ppc_gp0_regnum + regi,
865*11efff7fSkettenis buf + wordsize * regi);
866b725ae77Skettenis
867*11efff7fSkettenis right_supply_register (regcache, wordsize, gdbarch_pc_regnum (regcache_arch),
868*11efff7fSkettenis buf + wordsize * PPC_LINUX_PT_NIP);
869*11efff7fSkettenis right_supply_register (regcache, wordsize, regcache_tdep->ppc_lr_regnum,
870*11efff7fSkettenis buf + wordsize * PPC_LINUX_PT_LNK);
871*11efff7fSkettenis regcache_raw_supply (regcache, regcache_tdep->ppc_cr_regnum,
872*11efff7fSkettenis buf + wordsize * PPC_LINUX_PT_CCR);
873*11efff7fSkettenis regcache_raw_supply (regcache, regcache_tdep->ppc_xer_regnum,
874*11efff7fSkettenis buf + wordsize * PPC_LINUX_PT_XER);
875*11efff7fSkettenis regcache_raw_supply (regcache, regcache_tdep->ppc_ctr_regnum,
876*11efff7fSkettenis buf + wordsize * PPC_LINUX_PT_CTR);
877*11efff7fSkettenis if (regcache_tdep->ppc_mq_regnum != -1)
878*11efff7fSkettenis right_supply_register (regcache, wordsize, regcache_tdep->ppc_mq_regnum,
879*11efff7fSkettenis buf + wordsize * PPC_LINUX_PT_MQ);
880*11efff7fSkettenis right_supply_register (regcache, wordsize, regcache_tdep->ppc_ps_regnum,
881*11efff7fSkettenis buf + wordsize * PPC_LINUX_PT_MSR);
882b725ae77Skettenis }
883b725ae77Skettenis
884b725ae77Skettenis static void
ppc32_linux_supply_gregset(const struct regset * regset,struct regcache * regcache,int regnum,const void * gregs,size_t size)885*11efff7fSkettenis ppc32_linux_supply_gregset (const struct regset *regset,
886*11efff7fSkettenis struct regcache *regcache,
887*11efff7fSkettenis int regnum, const void *gregs, size_t size)
888b725ae77Skettenis {
889*11efff7fSkettenis ppc_linux_supply_gregset (regcache, regnum, gregs, size, 4);
890b725ae77Skettenis }
891b725ae77Skettenis
892*11efff7fSkettenis static struct regset ppc32_linux_gregset = {
893*11efff7fSkettenis NULL, ppc32_linux_supply_gregset
894b725ae77Skettenis };
895b725ae77Skettenis
896*11efff7fSkettenis struct ppc_linux_sigtramp_cache
897*11efff7fSkettenis {
898*11efff7fSkettenis CORE_ADDR base;
899*11efff7fSkettenis struct trad_frame_saved_reg *saved_regs;
900*11efff7fSkettenis };
901*11efff7fSkettenis
902*11efff7fSkettenis static struct ppc_linux_sigtramp_cache *
ppc_linux_sigtramp_cache(struct frame_info * next_frame,void ** this_cache)903*11efff7fSkettenis ppc_linux_sigtramp_cache (struct frame_info *next_frame, void **this_cache)
904*11efff7fSkettenis {
905*11efff7fSkettenis CORE_ADDR regs;
906*11efff7fSkettenis CORE_ADDR gpregs;
907*11efff7fSkettenis CORE_ADDR fpregs;
908*11efff7fSkettenis int i;
909*11efff7fSkettenis struct ppc_linux_sigtramp_cache *cache;
910*11efff7fSkettenis struct gdbarch *gdbarch = get_frame_arch (next_frame);
911*11efff7fSkettenis struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
912*11efff7fSkettenis
913*11efff7fSkettenis if ((*this_cache) != NULL)
914*11efff7fSkettenis return (*this_cache);
915*11efff7fSkettenis cache = FRAME_OBSTACK_ZALLOC (struct ppc_linux_sigtramp_cache);
916*11efff7fSkettenis (*this_cache) = cache;
917*11efff7fSkettenis cache->saved_regs = trad_frame_alloc_saved_regs (next_frame);
918*11efff7fSkettenis
919*11efff7fSkettenis cache->base = frame_unwind_register_unsigned (next_frame, SP_REGNUM);
920*11efff7fSkettenis
921*11efff7fSkettenis /* Find the register pointer, which gives the address of the
922*11efff7fSkettenis register buffers. */
923*11efff7fSkettenis if (tdep->wordsize == 4)
924*11efff7fSkettenis regs = (cache->base
925*11efff7fSkettenis + 0xd0 /* Offset to ucontext_t. */
926*11efff7fSkettenis + 0x30 /* Offset to .reg. */);
927*11efff7fSkettenis else
928*11efff7fSkettenis regs = (cache->base
929*11efff7fSkettenis + 0x80 /* Offset to ucontext_t. */
930*11efff7fSkettenis + 0xe0 /* Offset to .reg. */);
931*11efff7fSkettenis /* And the corresponding register buffers. */
932*11efff7fSkettenis gpregs = read_memory_unsigned_integer (regs, tdep->wordsize);
933*11efff7fSkettenis fpregs = gpregs + 48 * tdep->wordsize;
934*11efff7fSkettenis
935*11efff7fSkettenis /* General purpose. */
936*11efff7fSkettenis for (i = 0; i < ppc_num_gprs; i++)
937*11efff7fSkettenis {
938*11efff7fSkettenis int regnum = i + tdep->ppc_gp0_regnum;
939*11efff7fSkettenis cache->saved_regs[regnum].addr = gpregs + i * tdep->wordsize;
940*11efff7fSkettenis }
941*11efff7fSkettenis cache->saved_regs[PC_REGNUM].addr = gpregs + 32 * tdep->wordsize;
942*11efff7fSkettenis cache->saved_regs[tdep->ppc_ctr_regnum].addr = gpregs + 35 * tdep->wordsize;
943*11efff7fSkettenis cache->saved_regs[tdep->ppc_lr_regnum].addr = gpregs + 36 * tdep->wordsize;
944*11efff7fSkettenis cache->saved_regs[tdep->ppc_xer_regnum].addr = gpregs + 37 * tdep->wordsize;
945*11efff7fSkettenis cache->saved_regs[tdep->ppc_cr_regnum].addr = gpregs + 38 * tdep->wordsize;
946*11efff7fSkettenis
947*11efff7fSkettenis /* Floating point registers. */
948*11efff7fSkettenis if (ppc_floating_point_unit_p (gdbarch))
949*11efff7fSkettenis {
950*11efff7fSkettenis for (i = 0; i < ppc_num_fprs; i++)
951*11efff7fSkettenis {
952*11efff7fSkettenis int regnum = i + tdep->ppc_fp0_regnum;
953*11efff7fSkettenis cache->saved_regs[regnum].addr = fpregs + i * tdep->wordsize;
954*11efff7fSkettenis }
955*11efff7fSkettenis cache->saved_regs[tdep->ppc_fpscr_regnum].addr
956*11efff7fSkettenis = fpregs + 32 * tdep->wordsize;
957*11efff7fSkettenis }
958*11efff7fSkettenis
959*11efff7fSkettenis return cache;
960*11efff7fSkettenis }
961*11efff7fSkettenis
962*11efff7fSkettenis static void
ppc_linux_sigtramp_this_id(struct frame_info * next_frame,void ** this_cache,struct frame_id * this_id)963*11efff7fSkettenis ppc_linux_sigtramp_this_id (struct frame_info *next_frame, void **this_cache,
964*11efff7fSkettenis struct frame_id *this_id)
965*11efff7fSkettenis {
966*11efff7fSkettenis struct ppc_linux_sigtramp_cache *info
967*11efff7fSkettenis = ppc_linux_sigtramp_cache (next_frame, this_cache);
968*11efff7fSkettenis (*this_id) = frame_id_build (info->base, frame_pc_unwind (next_frame));
969*11efff7fSkettenis }
970*11efff7fSkettenis
971*11efff7fSkettenis static void
ppc_linux_sigtramp_prev_register(struct frame_info * next_frame,void ** this_cache,int regnum,int * optimizedp,enum lval_type * lvalp,CORE_ADDR * addrp,int * realnump,void * valuep)972*11efff7fSkettenis ppc_linux_sigtramp_prev_register (struct frame_info *next_frame,
973*11efff7fSkettenis void **this_cache,
974*11efff7fSkettenis int regnum, int *optimizedp,
975*11efff7fSkettenis enum lval_type *lvalp, CORE_ADDR *addrp,
976*11efff7fSkettenis int *realnump, void *valuep)
977*11efff7fSkettenis {
978*11efff7fSkettenis struct ppc_linux_sigtramp_cache *info
979*11efff7fSkettenis = ppc_linux_sigtramp_cache (next_frame, this_cache);
980*11efff7fSkettenis trad_frame_get_prev_register (next_frame, info->saved_regs, regnum,
981*11efff7fSkettenis optimizedp, lvalp, addrp, realnump, valuep);
982*11efff7fSkettenis }
983*11efff7fSkettenis
984*11efff7fSkettenis static const struct frame_unwind ppc_linux_sigtramp_unwind =
985*11efff7fSkettenis {
986*11efff7fSkettenis SIGTRAMP_FRAME,
987*11efff7fSkettenis ppc_linux_sigtramp_this_id,
988*11efff7fSkettenis ppc_linux_sigtramp_prev_register
989*11efff7fSkettenis };
990*11efff7fSkettenis
991*11efff7fSkettenis static const struct frame_unwind *
ppc_linux_sigtramp_sniffer(struct frame_info * next_frame)992*11efff7fSkettenis ppc_linux_sigtramp_sniffer (struct frame_info *next_frame)
993*11efff7fSkettenis {
994*11efff7fSkettenis struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (next_frame));
995*11efff7fSkettenis if (frame_pc_unwind (next_frame)
996*11efff7fSkettenis > frame_unwind_register_unsigned (next_frame, SP_REGNUM))
997*11efff7fSkettenis /* Assume anything that is vaguely on the stack is a signal
998*11efff7fSkettenis trampoline. */
999*11efff7fSkettenis return &ppc_linux_sigtramp_unwind;
1000*11efff7fSkettenis else
1001*11efff7fSkettenis return NULL;
1002*11efff7fSkettenis }
1003*11efff7fSkettenis
1004*11efff7fSkettenis static void
ppc64_linux_supply_gregset(const struct regset * regset,struct regcache * regcache,int regnum,const void * gregs,size_t size)1005*11efff7fSkettenis ppc64_linux_supply_gregset (const struct regset *regset,
1006*11efff7fSkettenis struct regcache * regcache,
1007*11efff7fSkettenis int regnum, const void *gregs, size_t size)
1008*11efff7fSkettenis {
1009*11efff7fSkettenis ppc_linux_supply_gregset (regcache, regnum, gregs, size, 8);
1010*11efff7fSkettenis }
1011*11efff7fSkettenis
1012*11efff7fSkettenis static struct regset ppc64_linux_gregset = {
1013*11efff7fSkettenis NULL, ppc64_linux_supply_gregset
1014*11efff7fSkettenis };
1015*11efff7fSkettenis
1016*11efff7fSkettenis void
ppc_linux_supply_fpregset(const struct regset * regset,struct regcache * regcache,int regnum,const void * fpset,size_t size)1017*11efff7fSkettenis ppc_linux_supply_fpregset (const struct regset *regset,
1018*11efff7fSkettenis struct regcache * regcache,
1019*11efff7fSkettenis int regnum, const void *fpset, size_t size)
1020*11efff7fSkettenis {
1021*11efff7fSkettenis int regi;
1022*11efff7fSkettenis struct gdbarch *regcache_arch = get_regcache_arch (regcache);
1023*11efff7fSkettenis struct gdbarch_tdep *regcache_tdep = gdbarch_tdep (regcache_arch);
1024*11efff7fSkettenis const bfd_byte *buf = fpset;
1025*11efff7fSkettenis
1026*11efff7fSkettenis if (! ppc_floating_point_unit_p (regcache_arch))
1027*11efff7fSkettenis return;
1028*11efff7fSkettenis
1029*11efff7fSkettenis for (regi = 0; regi < ppc_num_fprs; regi++)
1030*11efff7fSkettenis regcache_raw_supply (regcache,
1031*11efff7fSkettenis regcache_tdep->ppc_fp0_regnum + regi,
1032*11efff7fSkettenis buf + 8 * regi);
1033*11efff7fSkettenis
1034*11efff7fSkettenis /* The FPSCR is stored in the low order word of the last
1035*11efff7fSkettenis doubleword in the fpregset. */
1036*11efff7fSkettenis regcache_raw_supply (regcache, regcache_tdep->ppc_fpscr_regnum,
1037*11efff7fSkettenis buf + 8 * 32 + 4);
1038*11efff7fSkettenis }
1039*11efff7fSkettenis
1040*11efff7fSkettenis static struct regset ppc_linux_fpregset = { NULL, ppc_linux_supply_fpregset };
1041*11efff7fSkettenis
1042*11efff7fSkettenis static const struct regset *
ppc_linux_regset_from_core_section(struct gdbarch * core_arch,const char * sect_name,size_t sect_size)1043*11efff7fSkettenis ppc_linux_regset_from_core_section (struct gdbarch *core_arch,
1044*11efff7fSkettenis const char *sect_name, size_t sect_size)
1045*11efff7fSkettenis {
1046*11efff7fSkettenis struct gdbarch_tdep *tdep = gdbarch_tdep (core_arch);
1047*11efff7fSkettenis if (strcmp (sect_name, ".reg") == 0)
1048*11efff7fSkettenis {
1049*11efff7fSkettenis if (tdep->wordsize == 4)
1050*11efff7fSkettenis return &ppc32_linux_gregset;
1051*11efff7fSkettenis else
1052*11efff7fSkettenis return &ppc64_linux_gregset;
1053*11efff7fSkettenis }
1054*11efff7fSkettenis if (strcmp (sect_name, ".reg2") == 0)
1055*11efff7fSkettenis return &ppc_linux_fpregset;
1056*11efff7fSkettenis return NULL;
1057*11efff7fSkettenis }
1058*11efff7fSkettenis
1059b725ae77Skettenis static void
ppc_linux_init_abi(struct gdbarch_info info,struct gdbarch * gdbarch)1060b725ae77Skettenis ppc_linux_init_abi (struct gdbarch_info info,
1061b725ae77Skettenis struct gdbarch *gdbarch)
1062b725ae77Skettenis {
1063b725ae77Skettenis struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
1064b725ae77Skettenis
1065b725ae77Skettenis if (tdep->wordsize == 4)
1066b725ae77Skettenis {
1067*11efff7fSkettenis /* NOTE: jimb/2004-03-26: The System V ABI PowerPC Processor
1068*11efff7fSkettenis Supplement says that long doubles are sixteen bytes long.
1069*11efff7fSkettenis However, as one of the known warts of its ABI, PPC GNU/Linux
1070*11efff7fSkettenis uses eight-byte long doubles. GCC only recently got 128-bit
1071*11efff7fSkettenis long double support on PPC, so it may be changing soon. The
1072*11efff7fSkettenis Linux[sic] Standards Base says that programs that use 'long
1073*11efff7fSkettenis double' on PPC GNU/Linux are non-conformant. */
1074*11efff7fSkettenis set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
1075*11efff7fSkettenis
1076b725ae77Skettenis /* Until November 2001, gcc did not comply with the 32 bit SysV
1077b725ae77Skettenis R4 ABI requirement that structures less than or equal to 8
1078b725ae77Skettenis bytes should be returned in registers. Instead GCC was using
1079b725ae77Skettenis the the AIX/PowerOpen ABI - everything returned in memory
1080b725ae77Skettenis (well ignoring vectors that is). When this was corrected, it
1081b725ae77Skettenis wasn't fixed for GNU/Linux native platform. Use the
1082b725ae77Skettenis PowerOpen struct convention. */
1083b725ae77Skettenis set_gdbarch_return_value (gdbarch, ppc_linux_return_value);
1084b725ae77Skettenis
1085b725ae77Skettenis set_gdbarch_memory_remove_breakpoint (gdbarch,
1086b725ae77Skettenis ppc_linux_memory_remove_breakpoint);
1087*11efff7fSkettenis
1088b725ae77Skettenis /* Shared library handling. */
1089b725ae77Skettenis set_gdbarch_in_solib_call_trampoline (gdbarch, in_plt_section);
1090b725ae77Skettenis set_gdbarch_skip_trampoline_code (gdbarch,
1091b725ae77Skettenis ppc_linux_skip_trampoline_code);
1092b725ae77Skettenis set_solib_svr4_fetch_link_map_offsets
1093b725ae77Skettenis (gdbarch, ppc_linux_svr4_fetch_link_map_offsets);
1094b725ae77Skettenis }
1095b725ae77Skettenis
1096b725ae77Skettenis if (tdep->wordsize == 8)
1097b725ae77Skettenis {
1098b725ae77Skettenis /* Handle PPC64 GNU/Linux function pointers (which are really
1099b725ae77Skettenis function descriptors). */
1100b725ae77Skettenis set_gdbarch_convert_from_func_ptr_addr
1101b725ae77Skettenis (gdbarch, ppc64_linux_convert_from_func_ptr_addr);
1102b725ae77Skettenis
1103b725ae77Skettenis set_gdbarch_in_solib_call_trampoline
1104b725ae77Skettenis (gdbarch, ppc64_in_solib_call_trampoline);
1105b725ae77Skettenis set_gdbarch_skip_trampoline_code (gdbarch, ppc64_skip_trampoline_code);
1106b725ae77Skettenis
1107b725ae77Skettenis /* PPC64 malloc's entry-point is called ".malloc". */
1108b725ae77Skettenis set_gdbarch_name_of_malloc (gdbarch, ".malloc");
1109b725ae77Skettenis }
1110*11efff7fSkettenis set_gdbarch_regset_from_core_section (gdbarch, ppc_linux_regset_from_core_section);
1111*11efff7fSkettenis frame_unwind_append_sniffer (gdbarch, ppc_linux_sigtramp_sniffer);
1112b725ae77Skettenis }
1113b725ae77Skettenis
1114b725ae77Skettenis void
_initialize_ppc_linux_tdep(void)1115b725ae77Skettenis _initialize_ppc_linux_tdep (void)
1116b725ae77Skettenis {
1117b725ae77Skettenis /* Register for all sub-familes of the POWER/PowerPC: 32-bit and
1118b725ae77Skettenis 64-bit PowerPC, and the older rs6k. */
1119b725ae77Skettenis gdbarch_register_osabi (bfd_arch_powerpc, bfd_mach_ppc, GDB_OSABI_LINUX,
1120b725ae77Skettenis ppc_linux_init_abi);
1121b725ae77Skettenis gdbarch_register_osabi (bfd_arch_powerpc, bfd_mach_ppc64, GDB_OSABI_LINUX,
1122b725ae77Skettenis ppc_linux_init_abi);
1123b725ae77Skettenis gdbarch_register_osabi (bfd_arch_rs6000, bfd_mach_rs6k, GDB_OSABI_LINUX,
1124b725ae77Skettenis ppc_linux_init_abi);
1125b725ae77Skettenis }
1126