elf.h
上传用户:lgb322
上传日期:2013-02-24
资源大小:30529k
文件大小:3k
源码类别:

嵌入式Linux

开发平台:

Unix_Linux

  1. /*
  2.  * This file is subject to the terms and conditions of the GNU General Public
  3.  * License.  See the file "COPYING" in the main directory of this archive
  4.  * for more details.
  5.  */
  6. #ifndef __ASM_ELF_H
  7. #define __ASM_ELF_H
  8. /* ELF register definitions */
  9. #define ELF_NGREG 45
  10. #define ELF_NFPREG 33
  11. typedef unsigned long elf_greg_t;
  12. typedef elf_greg_t elf_gregset_t[ELF_NGREG];
  13. typedef double elf_fpreg_t;
  14. typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
  15. /*
  16.  * This is used to ensure we don't load something for the wrong architecture
  17.  * and also rejects IRIX binaries.
  18.  */
  19. #define elf_check_arch(hdr)
  20. ({
  21. int __res = 1;
  22. struct elfhdr *__h = (hdr);
  23. if (__h->e_machine != EM_MIPS)
  24. __res = 0;
  25. if (__h->e_flags & EF_MIPS_ARCH)
  26. __res = 0;
  27. __res;
  28. })
  29. /* This one accepts IRIX binaries.  */
  30. #define irix_elf_check_arch(hdr) ((hdr)->e_machine == EM_MIPS)
  31. /*
  32.  * These are used to set parameters in the core dumps.
  33.  */
  34. #define ELF_CLASS ELFCLASS32
  35. #ifdef __MIPSEB__
  36. #define ELF_DATA ELFDATA2MSB
  37. #elif __MIPSEL__
  38. #define ELF_DATA ELFDATA2LSB
  39. #endif
  40. #define ELF_ARCH EM_MIPS
  41. #define USE_ELF_CORE_DUMP
  42. #define ELF_EXEC_PAGESIZE 4096
  43. #define ELF_CORE_COPY_REGS(_dest,_regs)
  44. memcpy((char *) &_dest, (char *) _regs,
  45.        sizeof(struct pt_regs));
  46. /* This yields a mask that user programs can use to figure out what
  47.    instruction set this cpu supports.  This could be done in userspace,
  48.    but it's not easy, and we've already done it here.  */
  49. #define ELF_HWCAP       (0)
  50. /* This yields a string that ld.so will use to load implementation
  51.    specific libraries for optimization.  This is more specific in
  52.    intent than poking at uname or /proc/cpuinfo.
  53.    For the moment, we have only optimizations for the Intel generations,
  54.    but that could change... */
  55. #define ELF_PLATFORM  (NULL)
  56. /*
  57.  * See comments in asm-alpha/elf.h, this is the same thing
  58.  * on the MIPS.
  59.  */
  60. #define ELF_PLAT_INIT(_r) do { 
  61. _r->regs[1] = _r->regs[2] = _r->regs[3] = _r->regs[4] = 0;
  62. _r->regs[5] = _r->regs[6] = _r->regs[7] = _r->regs[8] = 0;
  63. _r->regs[9] = _r->regs[10] = _r->regs[11] = _r->regs[12] = 0;
  64. _r->regs[13] = _r->regs[14] = _r->regs[15] = _r->regs[16] = 0;
  65. _r->regs[17] = _r->regs[18] = _r->regs[19] = _r->regs[20] = 0;
  66. _r->regs[21] = _r->regs[22] = _r->regs[23] = _r->regs[24] = 0;
  67. _r->regs[25] = _r->regs[26] = _r->regs[27] = _r->regs[28] = 0;
  68. _r->regs[30] = _r->regs[31] = 0;
  69. } while (0)
  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         (TASK_SIZE / 3 * 2)
  75. #ifdef __KERNEL__
  76. #define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX)
  77. #endif
  78. #endif /* __ASM_ELF_H */