elf.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * Copyright (C) 2011 Tobias Klauser <[email protected]>
  4. */
  5. #ifndef _ASM_NIOS2_ELF_H
  6. #define _ASM_NIOS2_ELF_H
  7. #include <uapi/asm/elf.h>
  8. /*
  9. * This is used to ensure we don't load something for the wrong architecture.
  10. */
  11. #define elf_check_arch(x) ((x)->e_machine == EM_ALTERA_NIOS2)
  12. #define ELF_PLAT_INIT(_r, load_addr)
  13. #define CORE_DUMP_USE_REGSET
  14. #define ELF_EXEC_PAGESIZE 4096
  15. /* This is the location that an ET_DYN program is loaded if exec'ed. Typical
  16. use of this is to invoke "./ld.so someprog" to test out a new version of
  17. the loader. We need to make sure that it is out of the way of the program
  18. that it will "exec", and that there is sufficient room for the brk. */
  19. #define ELF_ET_DYN_BASE 0xD0000000UL
  20. /* regs is struct pt_regs, pr_reg is elf_gregset_t (which is
  21. now struct_user_regs, they are different) */
  22. #define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1
  23. struct linux_binprm;
  24. extern int arch_setup_additional_pages(struct linux_binprm *bprm,
  25. int uses_interp);
  26. #define ELF_CORE_COPY_REGS(pr_reg, regs) \
  27. { do { \
  28. /* Bleech. */ \
  29. pr_reg[0] = regs->r8; \
  30. pr_reg[1] = regs->r9; \
  31. pr_reg[2] = regs->r10; \
  32. pr_reg[3] = regs->r11; \
  33. pr_reg[4] = regs->r12; \
  34. pr_reg[5] = regs->r13; \
  35. pr_reg[6] = regs->r14; \
  36. pr_reg[7] = regs->r15; \
  37. pr_reg[8] = regs->r1; \
  38. pr_reg[9] = regs->r2; \
  39. pr_reg[10] = regs->r3; \
  40. pr_reg[11] = regs->r4; \
  41. pr_reg[12] = regs->r5; \
  42. pr_reg[13] = regs->r6; \
  43. pr_reg[14] = regs->r7; \
  44. pr_reg[15] = regs->orig_r2; \
  45. pr_reg[16] = regs->ra; \
  46. pr_reg[17] = regs->fp; \
  47. pr_reg[18] = regs->sp; \
  48. pr_reg[19] = regs->gp; \
  49. pr_reg[20] = regs->estatus; \
  50. pr_reg[21] = regs->ea; \
  51. pr_reg[22] = regs->orig_r7; \
  52. { \
  53. struct switch_stack *sw = ((struct switch_stack *)regs) - 1; \
  54. pr_reg[23] = sw->r16; \
  55. pr_reg[24] = sw->r17; \
  56. pr_reg[25] = sw->r18; \
  57. pr_reg[26] = sw->r19; \
  58. pr_reg[27] = sw->r20; \
  59. pr_reg[28] = sw->r21; \
  60. pr_reg[29] = sw->r22; \
  61. pr_reg[30] = sw->r23; \
  62. pr_reg[31] = sw->fp; \
  63. pr_reg[32] = sw->gp; \
  64. pr_reg[33] = sw->ra; \
  65. } \
  66. } while (0); }
  67. /* This yields a mask that user programs can use to figure out what
  68. instruction set this cpu supports. */
  69. #define ELF_HWCAP (0)
  70. /* This yields a string that ld.so will use to load implementation
  71. specific libraries for optimization. This is more specific in
  72. intent than poking at uname or /proc/cpuinfo. */
  73. #define ELF_PLATFORM (NULL)
  74. #endif /* _ASM_NIOS2_ELF_H */