som.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. #ifndef _LINUX_SOM_H
  2. #define _LINUX_SOM_H
  3. /* File format definition for SOM executables / shared libraries */
  4. /* we need struct timespec */
  5. #include <linux/time.h>
  6. #define SOM_PAGESIZE 4096
  7. /* this is the SOM header */
  8. struct som_hdr {
  9. short system_id; /* magic number - system */
  10. short a_magic; /* magic number - file type */
  11. unsigned int version_id; /* versiod ID: YYMMDDHH */
  12. struct timespec file_time; /* system clock */
  13. unsigned int entry_space; /* space for entry point */
  14. unsigned int entry_subspace; /* subspace for entry point */
  15. unsigned int entry_offset; /* offset of entry point */
  16. unsigned int aux_header_location; /* auxiliary header location */
  17. unsigned int aux_header_size; /* auxiliary header size */
  18. unsigned int som_length; /* length of entire SOM */
  19. unsigned int presumed_dp; /* compiler's DP value */
  20. unsigned int space_location; /* space dictionary location */
  21. unsigned int space_total; /* number of space entries */
  22. unsigned int subspace_location; /* subspace entries location */
  23. unsigned int subspace_total; /* number of subspace entries */
  24. unsigned int loader_fixup_location; /* MPE/iX loader fixup */
  25. unsigned int loader_fixup_total; /* number of fixup records */
  26. unsigned int space_strings_location; /* (sub)space names */
  27. unsigned int space_strings_size; /* size of strings area */
  28. unsigned int init_array_location; /* reserved */
  29. unsigned int init_array_total; /* reserved */
  30. unsigned int compiler_location; /* module dictionary */
  31. unsigned int compiler_total; /* number of modules */
  32. unsigned int symbol_location; /* symbol dictionary */
  33. unsigned int symbol_total; /* number of symbols */
  34. unsigned int fixup_request_location; /* fixup requests */
  35. unsigned int fixup_request_total; /* number of fixup requests */
  36. unsigned int symbol_strings_location;/* module & symbol names area */
  37. unsigned int symbol_strings_size; /* size of strings area */
  38. unsigned int unloadable_sp_location; /* unloadable spaces location */
  39. unsigned int unloadable_sp_size; /* size of data */
  40. unsigned int checksum;
  41. };
  42. /* values for system_id */
  43. #define SOM_SID_PARISC_1_0 0x020b
  44. #define SOM_SID_PARISC_1_1 0x0210
  45. #define SOM_SID_PARISC_2_0 0x0214
  46. /* values for a_magic */
  47. #define SOM_LIB_EXEC 0x0104
  48. #define SOM_RELOCATABLE 0x0106
  49. #define SOM_EXEC_NONSHARE 0x0107
  50. #define SOM_EXEC_SHARE 0x0108
  51. #define SOM_EXEC_DEMAND 0x010B
  52. #define SOM_LIB_DYN 0x010D
  53. #define SOM_LIB_SHARE 0x010E
  54. #define SOM_LIB_RELOC 0x0619
  55. /* values for version_id. Decimal not hex, yes. Grr. */
  56. #define SOM_ID_OLD 85082112
  57. #define SOM_ID_NEW 87102412
  58. struct aux_id {
  59. unsigned int mandatory :1; /* the linker must understand this */
  60. unsigned int copy :1; /* Must be copied by the linker */
  61. unsigned int append :1; /* Must be merged by the linker */
  62. unsigned int ignore :1; /* Discard section if unknown */
  63. unsigned int reserved :12;
  64. unsigned int type :16; /* Header type */
  65. unsigned int length; /* length of _following_ data */
  66. };
  67. /* The Exec Auxiliary Header. Called The HP-UX Header within HP apparently. */
  68. struct som_exec_auxhdr {
  69. struct aux_id som_auxhdr;
  70. int exec_tsize; /* Text size in bytes */
  71. int exec_tmem; /* Address to load text at */
  72. int exec_tfile; /* Location of text in file */
  73. int exec_dsize; /* Data size in bytes */
  74. int exec_dmem; /* Address to load data at */
  75. int exec_dfile; /* Location of data in file */
  76. int exec_bsize; /* Uninitialised data (bss) */
  77. int exec_entry; /* Address to start executing */
  78. int exec_flags; /* loader flags */
  79. int exec_bfill; /* initialisation value for bss */
  80. };
  81. /* Oh, the things people do to avoid casts. Shame it'll break with gcc's
  82. * new aliasing rules really.
  83. */
  84. union name_pt {
  85. char * n_name;
  86. unsigned int n_strx;
  87. };
  88. /* The Space Dictionary */
  89. struct space_dictionary_record {
  90. union name_pt name; /* index to subspace name */
  91. unsigned int is_loadable :1; /* loadable */
  92. unsigned int is_defined :1; /* defined within file */
  93. unsigned int is_private :1; /* not sharable */
  94. unsigned int has_intermediate_code :1; /* contains intermediate code */
  95. unsigned int is_tspecific :1; /* thread specific */
  96. unsigned int reserved :11; /* for future expansion */
  97. unsigned int sort_key :8; /* for linker */
  98. unsigned int reserved2 :8; /* for future expansion */
  99. int space_number; /* index */
  100. int subspace_index; /* index into subspace dict */
  101. unsigned int subspace_quantity; /* number of subspaces */
  102. int loader_fix_index; /* for loader */
  103. unsigned int loader_fix_quantity; /* for loader */
  104. int init_pointer_index; /* data pointer array index */
  105. unsigned int init_pointer_quantity; /* number of data pointers */
  106. };
  107. /* The Subspace Dictionary */
  108. struct subspace_dictionary_record {
  109. int space_index;
  110. unsigned int access_control_bits :7;
  111. unsigned int memory_resident :1;
  112. unsigned int dup_common :1;
  113. unsigned int is_common :1;
  114. unsigned int quadrant :2;
  115. unsigned int initially_frozen :1;
  116. unsigned int is_first :1;
  117. unsigned int code_only :1;
  118. unsigned int sort_key :8;
  119. unsigned int replicate_init :1;
  120. unsigned int continuation :1;
  121. unsigned int is_tspecific :1;
  122. unsigned int is_comdat :1;
  123. unsigned int reserved :4;
  124. int file_loc_init_value;
  125. unsigned int initialization_length;
  126. unsigned int subspace_start;
  127. unsigned int subspace_length;
  128. unsigned int reserved2 :5;
  129. unsigned int alignment :27;
  130. union name_pt name;
  131. int fixup_request_index;
  132. unsigned int fixup_request_quantity;
  133. };
  134. #endif /* _LINUX_SOM_H */