elf.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. #ifndef __ASM_SH_ELF_H
  2. #define __ASM_SH_ELF_H
  3. /* SH relocation types */
  4. #define R_SH_NONE 0
  5. #define R_SH_DIR32 1
  6. #define R_SH_REL32 2
  7. #define R_SH_DIR8WPN 3
  8. #define R_SH_IND12W 4
  9. #define R_SH_DIR8WPL 5
  10. #define R_SH_DIR8WPZ 6
  11. #define R_SH_DIR8BP 7
  12. #define R_SH_DIR8W 8
  13. #define R_SH_DIR8L 9
  14. #define R_SH_SWITCH16 25
  15. #define R_SH_SWITCH32 26
  16. #define R_SH_USES 27
  17. #define R_SH_COUNT 28
  18. #define R_SH_ALIGN 29
  19. #define R_SH_CODE 30
  20. #define R_SH_DATA 31
  21. #define R_SH_LABEL 32
  22. #define R_SH_SWITCH8 33
  23. #define R_SH_GNU_VTINHERIT 34
  24. #define R_SH_GNU_VTENTRY 35
  25. #define R_SH_TLS_GD_32 144
  26. #define R_SH_TLS_LD_32 145
  27. #define R_SH_TLS_LDO_32 146
  28. #define R_SH_TLS_IE_32 147
  29. #define R_SH_TLS_LE_32 148
  30. #define R_SH_TLS_DTPMOD32 149
  31. #define R_SH_TLS_DTPOFF32 150
  32. #define R_SH_TLS_TPOFF32 151
  33. #define R_SH_GOT32 160
  34. #define R_SH_PLT32 161
  35. #define R_SH_COPY 162
  36. #define R_SH_GLOB_DAT 163
  37. #define R_SH_JMP_SLOT 164
  38. #define R_SH_RELATIVE 165
  39. #define R_SH_GOTOFF 166
  40. #define R_SH_GOTPC 167
  41. /* Keep this the last entry. */
  42. #define R_SH_NUM 256
  43. /*
  44. * ELF register definitions..
  45. */
  46. #include <asm/ptrace.h>
  47. #include <asm/user.h>
  48. typedef unsigned long elf_greg_t;
  49. #define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t))
  50. typedef elf_greg_t elf_gregset_t[ELF_NGREG];
  51. typedef struct user_fpu_struct elf_fpregset_t;
  52. /*
  53. * This is used to ensure we don't load something for the wrong architecture.
  54. */
  55. #define elf_check_arch(x) ( (x)->e_machine == EM_SH )
  56. /*
  57. * These are used to set parameters in the core dumps.
  58. */
  59. #define ELF_CLASS ELFCLASS32
  60. #ifdef __LITTLE_ENDIAN__
  61. #define ELF_DATA ELFDATA2LSB
  62. #else
  63. #define ELF_DATA ELFDATA2MSB
  64. #endif
  65. #define ELF_ARCH EM_SH
  66. #define USE_ELF_CORE_DUMP
  67. #define ELF_EXEC_PAGESIZE 4096
  68. /* This is the location that an ET_DYN program is loaded if exec'ed. Typical
  69. use of this is to invoke "./ld.so someprog" to test out a new version of
  70. the loader. We need to make sure that it is out of the way of the program
  71. that it will "exec", and that there is sufficient room for the brk. */
  72. #define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3)
  73. #define ELF_CORE_COPY_REGS(_dest,_regs) \
  74. memcpy((char *) &_dest, (char *) _regs, \
  75. sizeof(struct pt_regs));
  76. /* This yields a mask that user programs can use to figure out what
  77. instruction set this CPU supports. This could be done in user space,
  78. but it's not easy, and we've already done it here. */
  79. #define ELF_HWCAP (0)
  80. /* This yields a string that ld.so will use to load implementation
  81. specific libraries for optimization. This is more specific in
  82. intent than poking at uname or /proc/cpuinfo.
  83. For the moment, we have only optimizations for the Intel generations,
  84. but that could change... */
  85. #define ELF_PLATFORM (NULL)
  86. #define ELF_PLAT_INIT(_r, load_addr) \
  87. do { _r->regs[0]=0; _r->regs[1]=0; _r->regs[2]=0; _r->regs[3]=0; \
  88. _r->regs[4]=0; _r->regs[5]=0; _r->regs[6]=0; _r->regs[7]=0; \
  89. _r->regs[8]=0; _r->regs[9]=0; _r->regs[10]=0; _r->regs[11]=0; \
  90. _r->regs[12]=0; _r->regs[13]=0; _r->regs[14]=0; \
  91. _r->sr = SR_FD; } while (0)
  92. #ifdef __KERNEL__
  93. #define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX_32BIT)
  94. struct task_struct;
  95. extern int dump_task_regs (struct task_struct *, elf_gregset_t *);
  96. extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *);
  97. #define ELF_CORE_COPY_TASK_REGS(tsk, elf_regs) dump_task_regs(tsk, elf_regs)
  98. #define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs)
  99. #endif
  100. #endif /* __ASM_SH_ELF_H */