elf.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. /* elf.h: FR-V ELF definitions
  2. *
  3. * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved.
  4. * Written by David Howells (dhowells@redhat.com)
  5. * - Derived from include/asm-m68knommu/elf.h
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version
  10. * 2 of the License, or (at your option) any later version.
  11. */
  12. #ifndef __ASM_ELF_H
  13. #define __ASM_ELF_H
  14. #include <asm/ptrace.h>
  15. #include <asm/user.h>
  16. struct elf32_hdr;
  17. /*
  18. * ELF header e_flags defines.
  19. */
  20. #define EF_FRV_GPR_MASK 0x00000003 /* mask for # of gprs */
  21. #define EF_FRV_GPR32 0x00000001 /* Only uses GR on 32-register */
  22. #define EF_FRV_GPR64 0x00000002 /* Only uses GR on 64-register */
  23. #define EF_FRV_FPR_MASK 0x0000000c /* mask for # of fprs */
  24. #define EF_FRV_FPR32 0x00000004 /* Only uses FR on 32-register */
  25. #define EF_FRV_FPR64 0x00000008 /* Only uses FR on 64-register */
  26. #define EF_FRV_FPR_NONE 0x0000000C /* Uses software floating-point */
  27. #define EF_FRV_DWORD_MASK 0x00000030 /* mask for dword support */
  28. #define EF_FRV_DWORD_YES 0x00000010 /* Assumes stack aligned to 8-byte boundaries. */
  29. #define EF_FRV_DWORD_NO 0x00000020 /* Assumes stack aligned to 4-byte boundaries. */
  30. #define EF_FRV_DOUBLE 0x00000040 /* Uses double instructions. */
  31. #define EF_FRV_MEDIA 0x00000080 /* Uses media instructions. */
  32. #define EF_FRV_PIC 0x00000100 /* Uses position independent code. */
  33. #define EF_FRV_NON_PIC_RELOCS 0x00000200 /* Does not use position Independent code. */
  34. #define EF_FRV_MULADD 0x00000400 /* -mmuladd */
  35. #define EF_FRV_BIGPIC 0x00000800 /* -fPIC */
  36. #define EF_FRV_LIBPIC 0x00001000 /* -mlibrary-pic */
  37. #define EF_FRV_G0 0x00002000 /* -G 0, no small data ptr */
  38. #define EF_FRV_NOPACK 0x00004000 /* -mnopack */
  39. #define EF_FRV_FDPIC 0x00008000 /* -mfdpic */
  40. #define EF_FRV_CPU_MASK 0xff000000 /* specific cpu bits */
  41. #define EF_FRV_CPU_GENERIC 0x00000000 /* Set CPU type is FR-V */
  42. #define EF_FRV_CPU_FR500 0x01000000 /* Set CPU type is FR500 */
  43. #define EF_FRV_CPU_FR300 0x02000000 /* Set CPU type is FR300 */
  44. #define EF_FRV_CPU_SIMPLE 0x03000000 /* SIMPLE */
  45. #define EF_FRV_CPU_TOMCAT 0x04000000 /* Tomcat, FR500 prototype */
  46. #define EF_FRV_CPU_FR400 0x05000000 /* Set CPU type is FR400 */
  47. #define EF_FRV_CPU_FR550 0x06000000 /* Set CPU type is FR550 */
  48. #define EF_FRV_CPU_FR405 0x07000000 /* Set CPU type is FR405 */
  49. #define EF_FRV_CPU_FR450 0x08000000 /* Set CPU type is FR450 */
  50. /*
  51. * FR-V ELF relocation types
  52. */
  53. /*
  54. * ELF register definitions..
  55. */
  56. typedef unsigned long elf_greg_t;
  57. #define ELF_NGREG (sizeof(struct pt_regs) / sizeof(elf_greg_t))
  58. typedef elf_greg_t elf_gregset_t[ELF_NGREG];
  59. typedef struct user_fpmedia_regs elf_fpregset_t;
  60. /*
  61. * This is used to ensure we don't load something for the wrong architecture.
  62. */
  63. extern int elf_check_arch(const struct elf32_hdr *hdr);
  64. #define elf_check_fdpic(x) ((x)->e_flags & EF_FRV_FDPIC && !((x)->e_flags & EF_FRV_NON_PIC_RELOCS))
  65. #define elf_check_const_displacement(x) ((x)->e_flags & EF_FRV_PIC)
  66. /*
  67. * These are used to set parameters in the core dumps.
  68. */
  69. #define ELF_CLASS ELFCLASS32
  70. #define ELF_DATA ELFDATA2MSB
  71. #define ELF_ARCH EM_FRV
  72. #define ELF_PLAT_INIT(_r) \
  73. do { \
  74. __kernel_frame0_ptr->gr16 = 0; \
  75. __kernel_frame0_ptr->gr17 = 0; \
  76. __kernel_frame0_ptr->gr18 = 0; \
  77. __kernel_frame0_ptr->gr19 = 0; \
  78. __kernel_frame0_ptr->gr20 = 0; \
  79. __kernel_frame0_ptr->gr21 = 0; \
  80. __kernel_frame0_ptr->gr22 = 0; \
  81. __kernel_frame0_ptr->gr23 = 0; \
  82. __kernel_frame0_ptr->gr24 = 0; \
  83. __kernel_frame0_ptr->gr25 = 0; \
  84. __kernel_frame0_ptr->gr26 = 0; \
  85. __kernel_frame0_ptr->gr27 = 0; \
  86. __kernel_frame0_ptr->gr29 = 0; \
  87. } while(0)
  88. #define ELF_FDPIC_PLAT_INIT(_regs, _exec_map_addr, _interp_map_addr, _dynamic_addr) \
  89. do { \
  90. __kernel_frame0_ptr->gr16 = _exec_map_addr; \
  91. __kernel_frame0_ptr->gr17 = _interp_map_addr; \
  92. __kernel_frame0_ptr->gr18 = _dynamic_addr; \
  93. __kernel_frame0_ptr->gr19 = 0; \
  94. __kernel_frame0_ptr->gr20 = 0; \
  95. __kernel_frame0_ptr->gr21 = 0; \
  96. __kernel_frame0_ptr->gr22 = 0; \
  97. __kernel_frame0_ptr->gr23 = 0; \
  98. __kernel_frame0_ptr->gr24 = 0; \
  99. __kernel_frame0_ptr->gr25 = 0; \
  100. __kernel_frame0_ptr->gr26 = 0; \
  101. __kernel_frame0_ptr->gr27 = 0; \
  102. __kernel_frame0_ptr->gr29 = 0; \
  103. } while(0)
  104. #define CORE_DUMP_USE_REGSET
  105. #define ELF_FDPIC_CORE_EFLAGS EF_FRV_FDPIC
  106. #define ELF_EXEC_PAGESIZE 16384
  107. /* This is the location that an ET_DYN program is loaded if exec'ed. Typical
  108. use of this is to invoke "./ld.so someprog" to test out a new version of
  109. the loader. We need to make sure that it is out of the way of the program
  110. that it will "exec", and that there is sufficient room for the brk. */
  111. #define ELF_ET_DYN_BASE 0x08000000UL
  112. /* This yields a mask that user programs can use to figure out what
  113. instruction set this cpu supports. */
  114. #define ELF_HWCAP (0)
  115. /* This yields a string that ld.so will use to load implementation
  116. specific libraries for optimization. This is more specific in
  117. intent than poking at uname or /proc/cpuinfo. */
  118. #define ELF_PLATFORM (NULL)
  119. #endif