arch.h revision 1b4c76e739f36a01ca4cc07a1df5aa5e970279e6
1#ifndef LTRACE_PPC_ARCH_H
2#define LTRACE_PPC_ARCH_H
3
4#include <gelf.h>
5
6#define BREAKPOINT_VALUE { 0x7f, 0xe0, 0x00, 0x08 }
7#define BREAKPOINT_LENGTH 4
8#define DECR_PC_AFTER_BREAK 0
9
10#define LT_ELFCLASS	ELFCLASS32
11#define LT_ELF_MACHINE	EM_PPC
12
13#ifdef __powerpc64__ // Says 'ltrace' is 64 bits, says nothing about target.
14#define LT_ELFCLASS2	ELFCLASS64
15#define LT_ELF_MACHINE2	EM_PPC64
16#define ARCH_SUPPORTS_OPD
17#endif
18
19#define PLT_REINITALISATION_BP    "_start"
20
21#define ARCH_HAVE_UMOVELONG
22#define ARCH_HAVE_ATOMIC_SINGLESTEP
23#define ARCH_HAVE_ADD_PLT_ENTRY
24#define ARCH_HAVE_LTELF_DATA
25#define ARCH_HAVE_BREAKPOINT_DATA
26#define ARCH_HAVE_LIBRARY_SYMBOL_DATA
27#define ARCH_HAVE_TRANSLATE_ADDRESS
28
29struct library_symbol;
30struct arch_ltelf_data {
31	GElf_Addr plt_stub_vma;
32	int secure_plt;
33	struct library_symbol *stubs;
34};
35
36enum ppc64_plt_type {
37	/* STUB, never resolved.  */
38	PPC64PLT_STUB,
39
40	/* Unresolved PLT symbol (.plt contains PLT address).  */
41	PPC64PLT_UNRESOLVED,
42
43	/* Resolved PLT symbol.  The corresponding .plt slot contained
44	 * target address, which was changed to the address of
45	 * corresponding PLT entry.  The original is now saved in
46	 * RESOLVED_VALUE.  */
47	PPC64PLT_RESOLVED,
48};
49
50struct arch_library_symbol_data {
51	enum ppc64_plt_type type;
52	GElf_Addr resolved_value;
53
54	/* Address of corresponding slot in .plt.  */
55	GElf_Addr plt_slot_addr;
56};
57
58struct arch_breakpoint_data {
59};
60
61#endif /* LTRACE_PPC_ARCH_H */
62