elf.h 4.1 KB

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