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