1014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch#ifndef _LINUX_SOM_H 2014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch#define _LINUX_SOM_H 3014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch 4014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch/* File format definition for SOM executables / shared libraries */ 5014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch 6014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch/* we need struct timespec */ 7014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch#include <linux/time.h> 8014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch 9014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch#define SOM_PAGESIZE 4096 10014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch 11014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch/* this is the SOM header */ 12014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdochstruct som_hdr { 13014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch short system_id; /* magic number - system */ 14014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch short a_magic; /* magic number - file type */ 15014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch unsigned int version_id; /* versiod ID: YYMMDDHH */ 16014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch struct timespec file_time; /* system clock */ 17014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch unsigned int entry_space; /* space for entry point */ 18014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch unsigned int entry_subspace; /* subspace for entry point */ 19014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch unsigned int entry_offset; /* offset of entry point */ 20014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch unsigned int aux_header_location; /* auxiliary header location */ 21014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch unsigned int aux_header_size; /* auxiliary header size */ 22014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch unsigned int som_length; /* length of entire SOM */ 23014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch unsigned int presumed_dp; /* compiler's DP value */ 24014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch unsigned int space_location; /* space dictionary location */ 25014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch unsigned int space_total; /* number of space entries */ 26014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch unsigned int subspace_location; /* subspace entries location */ 27014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch unsigned int subspace_total; /* number of subspace entries */ 28014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch unsigned int loader_fixup_location; /* MPE/iX loader fixup */ 29014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch unsigned int loader_fixup_total; /* number of fixup records */ 30014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch unsigned int space_strings_location; /* (sub)space names */ 31014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch unsigned int space_strings_size; /* size of strings area */ 32014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch unsigned int init_array_location; /* reserved */ 33014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch unsigned int init_array_total; /* reserved */ 34014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch unsigned int compiler_location; /* module dictionary */ 35014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch unsigned int compiler_total; /* number of modules */ 36014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch unsigned int symbol_location; /* symbol dictionary */ 37014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch unsigned int symbol_total; /* number of symbols */ 38014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch unsigned int fixup_request_location; /* fixup requests */ 39014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch unsigned int fixup_request_total; /* number of fixup requests */ 40014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch unsigned int symbol_strings_location;/* module & symbol names area */ 41014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch unsigned int symbol_strings_size; /* size of strings area */ 42014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch unsigned int unloadable_sp_location; /* unloadable spaces location */ 43014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch unsigned int unloadable_sp_size; /* size of data */ 44014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch unsigned int checksum; 45014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch}; 46014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch 47014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch/* values for system_id */ 48014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch 49014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch#define SOM_SID_PARISC_1_0 0x020b 50014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch#define SOM_SID_PARISC_1_1 0x0210 51014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch#define SOM_SID_PARISC_2_0 0x0214 52014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch 53014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch/* values for a_magic */ 54014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch 55014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch#define SOM_LIB_EXEC 0x0104 56014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch#define SOM_RELOCATABLE 0x0106 57014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch#define SOM_EXEC_NONSHARE 0x0107 58014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch#define SOM_EXEC_SHARE 0x0108 59014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch#define SOM_EXEC_DEMAND 0x010B 60014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch#define SOM_LIB_DYN 0x010D 61014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch#define SOM_LIB_SHARE 0x010E 62014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch#define SOM_LIB_RELOC 0x0619 63014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch 64014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch/* values for version_id. Decimal not hex, yes. Grr. */ 65014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch 66014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch#define SOM_ID_OLD 85082112 67014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch#define SOM_ID_NEW 87102412 68014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch 69014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdochstruct aux_id { 70014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch unsigned int mandatory :1; /* the linker must understand this */ 71014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch unsigned int copy :1; /* Must be copied by the linker */ 72014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch unsigned int append :1; /* Must be merged by the linker */ 73014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch unsigned int ignore :1; /* Discard section if unknown */ 74014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch unsigned int reserved :12; 75014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch unsigned int type :16; /* Header type */ 76014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch unsigned int length; /* length of _following_ data */ 77014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch}; 78014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch 79014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch/* The Exec Auxiliary Header. Called The HP-UX Header within HP apparently. */ 80014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdochstruct som_exec_auxhdr { 81014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch struct aux_id som_auxhdr; 82014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch int exec_tsize; /* Text size in bytes */ 83014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch int exec_tmem; /* Address to load text at */ 84014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch int exec_tfile; /* Location of text in file */ 85014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch int exec_dsize; /* Data size in bytes */ 86014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch int exec_dmem; /* Address to load data at */ 87014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch int exec_dfile; /* Location of data in file */ 88014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch int exec_bsize; /* Uninitialised data (bss) */ 89014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch int exec_entry; /* Address to start executing */ 90014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch int exec_flags; /* loader flags */ 91014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch int exec_bfill; /* initialisation value for bss */ 92014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch}; 93014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch 94014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch/* Oh, the things people do to avoid casts. Shame it'll break with gcc's 95014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch * new aliasing rules really. 96014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch */ 97014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdochunion name_pt { 98014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch char * n_name; 99014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch unsigned int n_strx; 100014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch}; 101014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch 102014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch/* The Space Dictionary */ 103014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdochstruct space_dictionary_record { 104014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch union name_pt name; /* index to subspace name */ 105014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch unsigned int is_loadable :1; /* loadable */ 106014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch unsigned int is_defined :1; /* defined within file */ 107014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch unsigned int is_private :1; /* not sharable */ 108014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch unsigned int has_intermediate_code :1; /* contains intermediate code */ 109014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch unsigned int is_tspecific :1; /* thread specific */ 110014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch unsigned int reserved :11; /* for future expansion */ 111014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch unsigned int sort_key :8; /* for linker */ 112014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch unsigned int reserved2 :8; /* for future expansion */ 113014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch 114014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch int space_number; /* index */ 115014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch int subspace_index; /* index into subspace dict */ 116014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch unsigned int subspace_quantity; /* number of subspaces */ 117014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch int loader_fix_index; /* for loader */ 118014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch unsigned int loader_fix_quantity; /* for loader */ 119014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch int init_pointer_index; /* data pointer array index */ 120 unsigned int init_pointer_quantity; /* number of data pointers */ 121}; 122 123/* The Subspace Dictionary */ 124struct subspace_dictionary_record { 125 int space_index; 126 unsigned int access_control_bits :7; 127 unsigned int memory_resident :1; 128 unsigned int dup_common :1; 129 unsigned int is_common :1; 130 unsigned int quadrant :2; 131 unsigned int initially_frozen :1; 132 unsigned int is_first :1; 133 unsigned int code_only :1; 134 unsigned int sort_key :8; 135 unsigned int replicate_init :1; 136 unsigned int continuation :1; 137 unsigned int is_tspecific :1; 138 unsigned int is_comdat :1; 139 unsigned int reserved :4; 140 141 int file_loc_init_value; 142 unsigned int initialization_length; 143 unsigned int subspace_start; 144 unsigned int subspace_length; 145 146 unsigned int reserved2 :5; 147 unsigned int alignment :27; 148 149 union name_pt name; 150 int fixup_request_index; 151 unsigned int fixup_request_quantity; 152}; 153 154#endif /* _LINUX_SOM_H */ 155