Dr Andrew Scott G7VAV

My photo
 
April 2024
Mo Tu We Th Fr Sa Su
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 7 8 9 10 11 12


a.out.h
001: #ifndef __A_OUT_GNU_H__
002: #define __A_OUT_GNU_H__
003: 
004: #include <bits/a.out.h>
005: 
006: #define __GNU_EXEC_MACROS__
007: 
008: struct exec
009: {
010:   unsigned long a_info; /* Use macros N_MAGIC, etc for access.  */
011:   unsigned int a_text;  /* Length of text, in bytes.  */
012:   unsigned int a_data;  /* Length of data, in bytes.  */
013:   unsigned int a_bss;   /* Length of uninitialized data area for file, in bytes.  */
014:   unsigned int a_syms;  /* Length of symbol table data in file, in bytes.  */
015:   unsigned int a_entry; /* Start address.  */
016:   unsigned int a_trsize;/* Length of relocation info for text, in bytes.  */
017:   unsigned int a_drsize;/* Length of relocation info for data, in bytes.  */
018: };
019: 
020: enum machine_type
021: {
022:   M_OLDSUN2 = 0,
023:   M_68010 = 1,
024:   M_68020 = 2,
025:   M_SPARC = 3,
026:   M_386 = 100,
027:   M_MIPS1 = 151,
028:   M_MIPS2 = 152
029: };
030: 
031: #define N_MAGIC(exec)   ((exec).a_info & 0xffff)
032: #define N_MACHTYPE(exec) ((enum machine_type)(((exec).a_info >> 16) & 0xff))
033: #define N_FLAGS(exec)   (((exec).a_info >> 24) & 0xff)
034: #define N_SET_INFO(exec, magic, type, flags) \
035:   ((exec).a_info = ((magic) & 0xffff)                                   \
036:    | (((int)(type) & 0xff) << 16)                                       \
037:    | (((flags) & 0xff) << 24))
038: #define N_SET_MAGIC(exec, magic) \
039:   ((exec).a_info = ((exec).a_info & 0xffff0000) | ((magic) & 0xffff))
040: #define N_SET_MACHTYPE(exec, machtype) \
041:   ((exec).a_info =                                                      \
042:    ((exec).a_info&0xff00ffff) | ((((int)(machtype))&0xff) << 16))
043: #define N_SET_FLAGS(exec, flags) \
044:   ((exec).a_info =                                                      \
045:    ((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24))
046: 
047: /* Code indicating object file or impure executable.  */
048: #define OMAGIC 0407
049: /* Code indicating pure executable.  */
050: #define NMAGIC 0410
051: /* Code indicating demand-paged executable.  */
052: #define ZMAGIC 0413
053: /* This indicates a demand-paged executable with the header in the text. 
054:    The first page is unmapped to help trap NULL pointer references.  */
055: #define QMAGIC 0314
056: /* Code indicating core file.  */
057: #define CMAGIC 0421
058: 
059: #define N_TRSIZE(a)     ((a).a_trsize)
060: #define N_DRSIZE(a)     ((a).a_drsize)
061: #define N_SYMSIZE(a)    ((a).a_syms)
062: #define N_BADMAG(x) \
063:   (N_MAGIC(x) != OMAGIC && N_MAGIC(x) != NMAGIC                         \
064:    && N_MAGIC(x) != ZMAGIC && N_MAGIC(x) != QMAGIC)
065: #define _N_HDROFF(x)    (1024 - sizeof (struct exec))
066: #define N_TXTOFF(x) \
067:   (N_MAGIC(x) == ZMAGIC ? _N_HDROFF((x)) + sizeof (struct exec) :       \
068:    (N_MAGIC(x) == QMAGIC ? 0 : sizeof (struct exec)))
069: #define N_DATOFF(x)     (N_TXTOFF(x) + (x).a_text)
070: #define N_TRELOFF(x)    (N_DATOFF(x) + (x).a_data)
071: #define N_DRELOFF(x)    (N_TRELOFF(x) + N_TRSIZE(x))
072: #define N_SYMOFF(x)     (N_DRELOFF(x) + N_DRSIZE(x))
073: #define N_STROFF(x)     (N_SYMOFF(x) + N_SYMSIZE(x))
074: 
075: /* Address of text segment in memory after it is loaded.  */
076: #define N_TXTADDR(x)    (N_MAGIC(x) == QMAGIC ? 4096 : 0)
077: 
078: /* Address of data segment in memory after it is loaded.  */
079: #define SEGMENT_SIZE    1024
080: 
081: #define _N_SEGMENT_ROUND(x) (((x) + SEGMENT_SIZE - 1) & ~(SEGMENT_SIZE - 1))
082: #define _N_TXTENDADDR(x) (N_TXTADDR(x)+(x).a_text)
083: 
084: #define N_DATADDR(x) \
085:   (N_MAGIC(x)==OMAGIC? (_N_TXTENDADDR(x))                               \
086:    : (_N_SEGMENT_ROUND (_N_TXTENDADDR(x))))
087: #define N_BSSADDR(x) (N_DATADDR(x) + (x).a_data)
088: 
089: #if !defined (N_NLIST_DECLARED)
090: struct nlist
091: {
092:   union
093:     {
094:       char *n_name;
095:       struct nlist *n_next;
096:       long n_strx;
097:     } n_un;
098:   unsigned char n_type;
099:   char n_other;
100:   short n_desc;
101:   unsigned long n_value;
102: };
103: #endif /* no N_NLIST_DECLARED.  */
104: 
105: #define N_UNDF  0
106: #define N_ABS   2
107: #define N_TEXT  4
108: #define N_DATA  6
109: #define N_BSS   8
110: #define N_FN    15
111: #define N_EXT   1
112: #define N_TYPE  036
113: #define N_STAB  0340
114: #define N_INDR  0xa
115: #define N_SETA  0x14    /* Absolute set element symbol.  */
116: #define N_SETT  0x16    /* Text set element symbol.  */
117: #define N_SETD  0x18    /* Data set element symbol.  */
118: #define N_SETB  0x1A    /* Bss set element symbol.  */
119: #define N_SETV  0x1C    /* Pointer to set vector in data area.  */
120: 
121: #if !defined (N_RELOCATION_INFO_DECLARED)
122: /* This structure describes a single relocation to be performed.
123:    The text-relocation section of the file is a vector of these structures,
124:    all of which apply to the text section.
125:    Likewise, the data-relocation section applies to the data section.  */
126: 
127: struct relocation_info
128: {
129:   int r_address;
130:   unsigned int r_symbolnum:24;
131:   unsigned int r_pcrel:1;
132:   unsigned int r_length:2;
133:   unsigned int r_extern:1;
134:   unsigned int r_pad:4;
135: };
136: #endif /* no N_RELOCATION_INFO_DECLARED.  */
137: 
138: #endif /* __A_OUT_GNU_H__ */
139: 


for client 18.216.32.116
© Andrew Scott 2006 - 2024,
All Rights Reserved
http://www.andrew-scott.uk/
Andrew Scott
http://www.andrew-scott.co.uk/