a.out.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /* $Id: a.out.h,v 1.8 2002/02/09 19:49:31 davem Exp $ */
  2. #ifndef __SPARC64_A_OUT_H__
  3. #define __SPARC64_A_OUT_H__
  4. #define SPARC_PGSIZE 0x2000 /* Thanks to the sun4 architecture... */
  5. #define SEGMENT_SIZE SPARC_PGSIZE /* whee... */
  6. #ifndef __ASSEMBLY__
  7. struct exec {
  8. unsigned char a_dynamic:1; /* A __DYNAMIC is in this image */
  9. unsigned char a_toolversion:7;
  10. unsigned char a_machtype;
  11. unsigned short a_info;
  12. unsigned int a_text; /* length of text, in bytes */
  13. unsigned int a_data; /* length of data, in bytes */
  14. unsigned int a_bss; /* length of bss, in bytes */
  15. unsigned int a_syms; /* length of symbol table, in bytes */
  16. unsigned int a_entry; /* where program begins */
  17. unsigned int a_trsize;
  18. unsigned int a_drsize;
  19. };
  20. #endif /* !__ASSEMBLY__ */
  21. /* Where in the file does the text information begin? */
  22. #define N_TXTOFF(x) (N_MAGIC(x) == ZMAGIC ? 0 : sizeof (struct exec))
  23. /* Where do the Symbols start? */
  24. #define N_SYMOFF(x) (N_TXTOFF(x) + (x).a_text + \
  25. (x).a_data + (x).a_trsize + \
  26. (x).a_drsize)
  27. /* Where does text segment go in memory after being loaded? */
  28. #define N_TXTADDR(x) (unsigned long)(((N_MAGIC(x) == ZMAGIC) && \
  29. ((x).a_entry < SPARC_PGSIZE)) ? \
  30. 0 : SPARC_PGSIZE)
  31. /* And same for the data segment.. */
  32. #define N_DATADDR(x) (N_MAGIC(x)==OMAGIC ? \
  33. (N_TXTADDR(x) + (x).a_text) \
  34. : (unsigned long)(_N_SEGMENT_ROUND (_N_TXTENDADDR(x))))
  35. #define N_TRSIZE(a) ((a).a_trsize)
  36. #define N_DRSIZE(a) ((a).a_drsize)
  37. #define N_SYMSIZE(a) ((a).a_syms)
  38. #ifndef __ASSEMBLY__
  39. /*
  40. * Sparc relocation types
  41. */
  42. enum reloc_type
  43. {
  44. RELOC_8,
  45. RELOC_16,
  46. RELOC_32, /* simplest relocs */
  47. RELOC_DISP8,
  48. RELOC_DISP16,
  49. RELOC_DISP32, /* Disp's (pc-rel) */
  50. RELOC_WDISP30,
  51. RELOC_WDISP22, /* SR word disp's */
  52. RELOC_HI22,
  53. RELOC_22, /* SR 22-bit relocs */
  54. RELOC_13,
  55. RELOC_LO10, /* SR 13&10-bit relocs */
  56. RELOC_SFA_BASE,
  57. RELOC_SFA_OFF13, /* SR S.F.A. relocs */
  58. RELOC_BASE10,
  59. RELOC_BASE13,
  60. RELOC_BASE22, /* base_relative pic */
  61. RELOC_PC10,
  62. RELOC_PC22, /* special pc-rel pic */
  63. RELOC_JMP_TBL, /* jmp_tbl_rel in pic */
  64. RELOC_SEGOFF16, /* ShLib offset-in-seg */
  65. RELOC_GLOB_DAT,
  66. RELOC_JMP_SLOT,
  67. RELOC_RELATIVE /* rtld relocs */
  68. };
  69. /*
  70. * Format of a relocation datum.
  71. */
  72. struct relocation_info /* used when header.a_machtype == M_SPARC */
  73. {
  74. unsigned int r_address; /* relocation addr */
  75. unsigned int r_index:24; /* segment index or symbol index */
  76. unsigned int r_extern:1; /* if F, r_index==SEG#; if T, SYM idx */
  77. unsigned int r_pad:2; /* <unused> */
  78. enum reloc_type r_type:5; /* type of relocation to perform */
  79. int r_addend; /* addend for relocation value */
  80. };
  81. #define N_RELOCATION_INFO_DECLARED 1
  82. #ifdef __KERNEL__
  83. #define STACK_TOP32 ((1UL << 32UL) - PAGE_SIZE)
  84. #define STACK_TOP64 (0x0000080000000000UL - (1UL << 32UL))
  85. #define STACK_TOP (test_thread_flag(TIF_32BIT) ? \
  86. STACK_TOP32 : STACK_TOP64)
  87. #define STACK_TOP_MAX STACK_TOP64
  88. #endif
  89. #endif /* !(__ASSEMBLY__) */
  90. #endif /* !(__SPARC64_A_OUT_H__) */