elf.h 4.1 KB

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