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