arch.h revision fbd9742d03154ca842eeae8f6a32e35c1e3c8326
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_TRANSLATE_ADDRESS
25
26struct library_symbol;
27
28#define ARCH_HAVE_LTELF_DATA
29struct arch_ltelf_data {
30	GElf_Addr plt_stub_vma;
31	int secure_plt;
32	struct library_symbol *stubs;
33};
34
35enum ppc64_plt_type {
36	/* Either a non-PLT symbol, or PPC32 symbol.  */
37	PPC_DEFAULT = 0,
38
39	/* STUB, never resolved.  */
40	PPC64PLT_STUB,
41
42	/* Unresolved PLT symbol (.plt contains PLT address).  */
43	PPC64PLT_UNRESOLVED,
44
45	/* Resolved PLT symbol.  The corresponding .plt slot contained
46	 * target address, which was changed to the address of
47	 * corresponding PLT entry.  The original is now saved in
48	 * RESOLVED_VALUE.  */
49	PPC64PLT_RESOLVED,
50};
51
52#define ARCH_HAVE_LIBRARY_SYMBOL_DATA
53struct arch_library_symbol_data {
54	enum ppc64_plt_type type;
55	GElf_Addr resolved_value;
56
57	/* Address of corresponding slot in .plt.  */
58	GElf_Addr plt_slot_addr;
59};
60
61#define ARCH_HAVE_BREAKPOINT_DATA
62struct arch_breakpoint_data {
63	/* We need this just for arch_breakpoint_init.  */
64};
65
66#define ARCH_HAVE_PROCESS_DATA
67struct arch_process_data {
68	/* Breakpoint that hits when the dynamic linker is about to
69	 * update a .plt slot.  NULL before that address is known.  */
70	struct breakpoint *dl_plt_update_bp;
71
72	/* PLT update breakpoint looks here for the handler.  */
73	struct process_stopping_handler *handler;
74};
75
76#endif /* LTRACE_PPC_ARCH_H */
77