elf.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /*
  2. * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. *
  17. */
  18. #ifndef _ASM_NIOS2_ELF_H
  19. #define _ASM_NIOS2_ELF_H
  20. #include <uapi/asm/elf.h>
  21. /*
  22. * This is used to ensure we don't load something for the wrong architecture.
  23. */
  24. #define elf_check_arch(x) ((x)->e_machine == EM_ALTERA_NIOS2)
  25. #define ELF_PLAT_INIT(_r, load_addr)
  26. #define CORE_DUMP_USE_REGSET
  27. #define ELF_EXEC_PAGESIZE 4096
  28. /* This is the location that an ET_DYN program is loaded if exec'ed. Typical
  29. use of this is to invoke "./ld.so someprog" to test out a new version of
  30. the loader. We need to make sure that it is out of the way of the program
  31. that it will "exec", and that there is sufficient room for the brk. */
  32. #define ELF_ET_DYN_BASE 0xD0000000UL
  33. /* regs is struct pt_regs, pr_reg is elf_gregset_t (which is
  34. now struct_user_regs, they are different) */
  35. #define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1
  36. struct linux_binprm;
  37. extern int arch_setup_additional_pages(struct linux_binprm *bprm,
  38. int uses_interp);
  39. #define ELF_CORE_COPY_REGS(pr_reg, regs) \
  40. { do { \
  41. /* Bleech. */ \
  42. pr_reg[0] = regs->r8; \
  43. pr_reg[1] = regs->r9; \
  44. pr_reg[2] = regs->r10; \
  45. pr_reg[3] = regs->r11; \
  46. pr_reg[4] = regs->r12; \
  47. pr_reg[5] = regs->r13; \
  48. pr_reg[6] = regs->r14; \
  49. pr_reg[7] = regs->r15; \
  50. pr_reg[8] = regs->r1; \
  51. pr_reg[9] = regs->r2; \
  52. pr_reg[10] = regs->r3; \
  53. pr_reg[11] = regs->r4; \
  54. pr_reg[12] = regs->r5; \
  55. pr_reg[13] = regs->r6; \
  56. pr_reg[14] = regs->r7; \
  57. pr_reg[15] = regs->orig_r2; \
  58. pr_reg[16] = regs->ra; \
  59. pr_reg[17] = regs->fp; \
  60. pr_reg[18] = regs->sp; \
  61. pr_reg[19] = regs->gp; \
  62. pr_reg[20] = regs->estatus; \
  63. pr_reg[21] = regs->ea; \
  64. pr_reg[22] = regs->orig_r7; \
  65. { \
  66. struct switch_stack *sw = ((struct switch_stack *)regs) - 1; \
  67. pr_reg[23] = sw->r16; \
  68. pr_reg[24] = sw->r17; \
  69. pr_reg[25] = sw->r18; \
  70. pr_reg[26] = sw->r19; \
  71. pr_reg[27] = sw->r20; \
  72. pr_reg[28] = sw->r21; \
  73. pr_reg[29] = sw->r22; \
  74. pr_reg[30] = sw->r23; \
  75. pr_reg[31] = sw->fp; \
  76. pr_reg[32] = sw->gp; \
  77. pr_reg[33] = sw->ra; \
  78. } \
  79. } while (0); }
  80. /* This yields a mask that user programs can use to figure out what
  81. instruction set this cpu supports. */
  82. #define ELF_HWCAP (0)
  83. /* This yields a string that ld.so will use to load implementation
  84. specific libraries for optimization. This is more specific in
  85. intent than poking at uname or /proc/cpuinfo. */
  86. #define ELF_PLATFORM (NULL)
  87. #endif /* _ASM_NIOS2_ELF_H */