Dr Andrew Scott G7VAV

My photo
 
June 2025
Mo Tu We Th Fr Sa Su
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 1 2 3 4 5 6


som.h
001: #ifndef _LINUX_SOM_H
002: #define _LINUX_SOM_H
003: 
004: /* File format definition for SOM executables / shared libraries */
005: 
006: /* we need struct timespec */
007: #include <linux/time.h>
008: 
009: #define SOM_PAGESIZE 4096
010: 
011: /* this is the SOM header */
012: struct som_hdr {
013:         short           system_id;              /* magic number - system */
014:         short           a_magic;                /* magic number - file type */
015:         unsigned int    version_id;             /* versiod ID: YYMMDDHH */
016:         struct timespec file_time;              /* system clock */
017:         unsigned int    entry_space;            /* space for entry point */
018:         unsigned int    entry_subspace;         /* subspace for entry point */
019:         unsigned int    entry_offset;           /* offset of entry point */
020:         unsigned int    aux_header_location;    /* auxiliary header location */
021:         unsigned int    aux_header_size;        /* auxiliary header size */
022:         unsigned int    som_length;             /* length of entire SOM */
023:         unsigned int    presumed_dp;            /* compiler's DP value */
024:         unsigned int    space_location;         /* space dictionary location */
025:         unsigned int    space_total;            /* number of space entries */
026:         unsigned int    subspace_location;      /* subspace entries location */
027:         unsigned int    subspace_total;         /* number of subspace entries */
028:         unsigned int    loader_fixup_location;  /* MPE/iX loader fixup */
029:         unsigned int    loader_fixup_total;     /* number of fixup records */
030:         unsigned int    space_strings_location; /* (sub)space names */
031:         unsigned int    space_strings_size;     /* size of strings area */
032:         unsigned int    init_array_location;    /* reserved */
033:         unsigned int    init_array_total;       /* reserved */
034:         unsigned int    compiler_location;      /* module dictionary */
035:         unsigned int    compiler_total;         /* number of modules */
036:         unsigned int    symbol_location;        /* symbol dictionary */
037:         unsigned int    symbol_total;           /* number of symbols */
038:         unsigned int    fixup_request_location; /* fixup requests */
039:         unsigned int    fixup_request_total;    /* number of fixup requests */
040:         unsigned int    symbol_strings_location;/* module & symbol names area */
041:         unsigned int    symbol_strings_size;    /* size of strings area */
042:         unsigned int    unloadable_sp_location; /* unloadable spaces location */
043:         unsigned int    unloadable_sp_size;     /* size of data */
044:         unsigned int    checksum;
045: };
046: 
047: /* values for system_id */
048: 
049: #define SOM_SID_PARISC_1_0      0x020b
050: #define SOM_SID_PARISC_1_1      0x0210
051: #define SOM_SID_PARISC_2_0      0x0214
052: 
053: /* values for a_magic */
054: 
055: #define SOM_LIB_EXEC            0x0104
056: #define SOM_RELOCATABLE         0x0106
057: #define SOM_EXEC_NONSHARE       0x0107
058: #define SOM_EXEC_SHARE          0x0108
059: #define SOM_EXEC_DEMAND         0x010B
060: #define SOM_LIB_DYN             0x010D
061: #define SOM_LIB_SHARE           0x010E
062: #define SOM_LIB_RELOC           0x0619
063: 
064: /* values for version_id.  Decimal not hex, yes.  Grr. */
065: 
066: #define SOM_ID_OLD              85082112
067: #define SOM_ID_NEW              87102412
068: 
069: struct aux_id {
070:         unsigned int    mandatory :1;   /* the linker must understand this */
071:         unsigned int    copy      :1;   /* Must be copied by the linker */
072:         unsigned int    append    :1;   /* Must be merged by the linker */
073:         unsigned int    ignore    :1;   /* Discard section if unknown */
074:         unsigned int    reserved  :12;
075:         unsigned int    type      :16;  /* Header type */
076:         unsigned int    length;         /* length of _following_ data */
077: };
078: 
079: /* The Exec Auxiliary Header.  Called The HP-UX Header within HP apparently. */
080: struct som_exec_auxhdr {
081:         struct aux_id   som_auxhdr;
082:         int             exec_tsize;     /* Text size in bytes */
083:         int             exec_tmem;      /* Address to load text at */
084:         int             exec_tfile;     /* Location of text in file */
085:         int             exec_dsize;     /* Data size in bytes */
086:         int             exec_dmem;      /* Address to load data at */
087:         int             exec_dfile;     /* Location of data in file */
088:         int             exec_bsize;     /* Uninitialised data (bss) */
089:         int             exec_entry;     /* Address to start executing */
090:         int             exec_flags;     /* loader flags */
091:         int             exec_bfill;     /* initialisation value for bss */
092: };
093: 
094: /* Oh, the things people do to avoid casts.  Shame it'll break with gcc's
095:  * new aliasing rules really.
096:  */
097: union name_pt {
098:         char *          n_name;
099:         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 */
155: 


for client (none)
© Andrew Scott 2006 - 2025,
All Rights Reserved
http://www.andrew-scott.uk/
Andrew Scott
http://www.andrew-scott.co.uk/