arch.h revision abfe118271cd45581f33f71b0cf0fddc3a2e1b05
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	/* STUB, never resolved.  */
37	PPC64PLT_STUB,
38
39	/* Unresolved PLT symbol (.plt contains PLT address).  */
40	PPC64PLT_UNRESOLVED,
41
42	/* Resolved PLT symbol.  The corresponding .plt slot contained
43	 * target address, which was changed to the address of
44	 * corresponding PLT entry.  The original is now saved in
45	 * RESOLVED_VALUE.  */
46	PPC64PLT_RESOLVED,
47};
48
49#define ARCH_HAVE_LIBRARY_SYMBOL_DATA
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
58#define ARCH_HAVE_BREAKPOINT_DATA
59struct arch_breakpoint_data {
60	/* We need this just for arch_breakpoint_init.  */
61};
62
63#endif /* LTRACE_PPC_ARCH_H */
64