elf.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. /* $Id: elf.h,v 1.22 2000/07/12 01:27:08 davem Exp $ */
  2. #ifndef __ASMSPARC_ELF_H
  3. #define __ASMSPARC_ELF_H
  4. /*
  5. * ELF register definitions..
  6. */
  7. #include <linux/config.h>
  8. #include <asm/ptrace.h>
  9. #ifdef __KERNEL__
  10. #include <asm/mbus.h>
  11. #include <asm/uaccess.h>
  12. #endif
  13. /*
  14. * Sparc section types
  15. */
  16. #define STT_REGISTER 13
  17. /*
  18. * Sparc ELF relocation types
  19. */
  20. #define R_SPARC_NONE 0
  21. #define R_SPARC_8 1
  22. #define R_SPARC_16 2
  23. #define R_SPARC_32 3
  24. #define R_SPARC_DISP8 4
  25. #define R_SPARC_DISP16 5
  26. #define R_SPARC_DISP32 6
  27. #define R_SPARC_WDISP30 7
  28. #define R_SPARC_WDISP22 8
  29. #define R_SPARC_HI22 9
  30. #define R_SPARC_22 10
  31. #define R_SPARC_13 11
  32. #define R_SPARC_LO10 12
  33. #define R_SPARC_GOT10 13
  34. #define R_SPARC_GOT13 14
  35. #define R_SPARC_GOT22 15
  36. #define R_SPARC_PC10 16
  37. #define R_SPARC_PC22 17
  38. #define R_SPARC_WPLT30 18
  39. #define R_SPARC_COPY 19
  40. #define R_SPARC_GLOB_DAT 20
  41. #define R_SPARC_JMP_SLOT 21
  42. #define R_SPARC_RELATIVE 22
  43. #define R_SPARC_UA32 23
  44. #define R_SPARC_PLT32 24
  45. #define R_SPARC_HIPLT22 25
  46. #define R_SPARC_LOPLT10 26
  47. #define R_SPARC_PCPLT32 27
  48. #define R_SPARC_PCPLT22 28
  49. #define R_SPARC_PCPLT10 29
  50. #define R_SPARC_10 30
  51. #define R_SPARC_11 31
  52. #define R_SPARC_64 32
  53. #define R_SPARC_OLO10 33
  54. #define R_SPARC_WDISP16 40
  55. #define R_SPARC_WDISP19 41
  56. #define R_SPARC_7 43
  57. #define R_SPARC_5 44
  58. #define R_SPARC_6 45
  59. /* Bits present in AT_HWCAP, primarily for Sparc32. */
  60. #define HWCAP_SPARC_FLUSH 1 /* CPU supports flush instruction. */
  61. #define HWCAP_SPARC_STBAR 2
  62. #define HWCAP_SPARC_SWAP 4
  63. #define HWCAP_SPARC_MULDIV 8
  64. #define HWCAP_SPARC_V9 16
  65. #define HWCAP_SPARC_ULTRA3 32
  66. /* For the most part we present code dumps in the format
  67. * Solaris does.
  68. */
  69. typedef unsigned long elf_greg_t;
  70. #define ELF_NGREG 38
  71. typedef elf_greg_t elf_gregset_t[ELF_NGREG];
  72. /* Format is:
  73. * G0 --> G7
  74. * O0 --> O7
  75. * L0 --> L7
  76. * I0 --> I7
  77. * PSR, PC, nPC, Y, WIM, TBR
  78. */
  79. #define ELF_CORE_COPY_REGS(__elf_regs, __pt_regs) \
  80. do { unsigned long *dest = &(__elf_regs[0]); \
  81. struct pt_regs *src = (__pt_regs); \
  82. unsigned long __user *sp; \
  83. memcpy(&dest[0], &src->u_regs[0], \
  84. sizeof(unsigned long) * 16); \
  85. /* Don't try this at home kids... */ \
  86. sp = (unsigned long __user *) src->u_regs[14]; \
  87. copy_from_user(&dest[16], sp, \
  88. sizeof(unsigned long) * 16); \
  89. dest[32] = src->psr; \
  90. dest[33] = src->pc; \
  91. dest[34] = src->npc; \
  92. dest[35] = src->y; \
  93. dest[36] = dest[37] = 0; /* XXX */ \
  94. } while(0); /* Janitors: Don't touch this colon. */
  95. typedef struct {
  96. union {
  97. unsigned long pr_regs[32];
  98. double pr_dregs[16];
  99. } pr_fr;
  100. unsigned long __unused;
  101. unsigned long pr_fsr;
  102. unsigned char pr_qcnt;
  103. unsigned char pr_q_entrysize;
  104. unsigned char pr_en;
  105. unsigned int pr_q[64];
  106. } elf_fpregset_t;
  107. #define ELF_CORE_COPY_TASK_REGS(__tsk, __elf_regs) \
  108. ({ ELF_CORE_COPY_REGS((*(__elf_regs)), (__tsk)->thread.kregs); 1; })
  109. /*
  110. * This is used to ensure we don't load something for the wrong architecture.
  111. */
  112. #define elf_check_arch(x) ((x)->e_machine == EM_SPARC)
  113. /*
  114. * These are used to set parameters in the core dumps.
  115. */
  116. #define ELF_ARCH EM_SPARC
  117. #define ELF_CLASS ELFCLASS32
  118. #define ELF_DATA ELFDATA2MSB
  119. #define USE_ELF_CORE_DUMP
  120. #ifndef CONFIG_SUN4
  121. #define ELF_EXEC_PAGESIZE 4096
  122. #else
  123. #define ELF_EXEC_PAGESIZE 8192
  124. #endif
  125. /* This is the location that an ET_DYN program is loaded if exec'ed. Typical
  126. use of this is to invoke "./ld.so someprog" to test out a new version of
  127. the loader. We need to make sure that it is out of the way of the program
  128. that it will "exec", and that there is sufficient room for the brk. */
  129. #define ELF_ET_DYN_BASE (TASK_UNMAPPED_BASE)
  130. /* This yields a mask that user programs can use to figure out what
  131. instruction set this cpu supports. This can NOT be done in userspace
  132. on Sparc. */
  133. /* Sun4c has none of the capabilities, most sun4m's have them all.
  134. * XXX This is gross, set some global variable at boot time. -DaveM
  135. */
  136. #define ELF_HWCAP ((ARCH_SUN4C_SUN4) ? 0 : \
  137. (HWCAP_SPARC_FLUSH | HWCAP_SPARC_STBAR | \
  138. HWCAP_SPARC_SWAP | \
  139. ((srmmu_modtype != Cypress && \
  140. srmmu_modtype != Cypress_vE && \
  141. srmmu_modtype != Cypress_vD) ? \
  142. HWCAP_SPARC_MULDIV : 0)))
  143. /* This yields a string that ld.so will use to load implementation
  144. specific libraries for optimization. This is more specific in
  145. intent than poking at uname or /proc/cpuinfo. */
  146. #define ELF_PLATFORM (NULL)
  147. #ifdef __KERNEL__
  148. #define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX)
  149. #endif
  150. #endif /* !(__ASMSPARC_ELF_H) */