source: trunk/libs/newlib/src/include/nlm/internal.h @ 609

Last change on this file since 609 was 444, checked in by satin@…, 7 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 10.9 KB
RevLine 
[444]1/* NLM (NetWare Loadable Module) support for BFD.
2   Copyright 1993, 1994, 2003, 2005, 2010 Free Software Foundation, Inc.
3
4   Written by Fred Fish @ Cygnus Support.
5
6   This file is part of BFD, the Binary File Descriptor library.
7
8   This program is free software; you can redistribute it and/or modify
9   it under the terms of the GNU General Public License as published by
10   the Free Software Foundation; either version 3 of the License, or
11   (at your option) any later version.
12
13   This program is distributed in the hope that it will be useful,
14   but WITHOUT ANY WARRANTY; without even the implied warranty of
15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16   GNU General Public License for more details.
17
18   You should have received a copy of the GNU General Public License
19   along with this program; if not, write to the Free Software
20   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
21   MA 02110-1301, USA.  */
22
23/* This file is part of NLM support for BFD, and contains the portions
24   that describe how NLM is represented internally in the BFD library.
25   I.E. it describes the in-memory representation of NLM.  It requires
26   the nlm/common.h file which contains the portions that are common to
27   both the internal and external representations.  */
28   
29#if 0
30
31/* Types used by various structures, functions, etc.  */
32
33typedef unsigned long   Nlm32_Addr;     /* Unsigned program address */
34typedef unsigned long   Nlm32_Off;      /* Unsigned file offset */
35typedef          long   Nlm32_Sword;    /* Signed large integer */
36typedef unsigned long   Nlm32_Word;     /* Unsigned large integer */
37typedef unsigned short  Nlm32_Half;     /* Unsigned medium integer */
38typedef unsigned char   Nlm32_Char;     /* Unsigned tiny integer */
39
40#ifdef BFD_HOST_64_BIT
41typedef unsigned BFD_HOST_64_BIT        Nlm64_Addr;
42typedef unsigned BFD_HOST_64_BIT        Nlm64_Off;
43typedef          BFD_HOST_64_BIT        Nlm64_Sxword;
44typedef unsigned BFD_HOST_64_BIT        Nlm64_Xword;
45#endif
46typedef          long           Nlm64_Sword;
47typedef unsigned long           Nlm64_Word;
48typedef unsigned short          Nlm64_Half;
49
50#endif /* 0 */
51
52/* This structure contains the internal form of the portion of the NLM
53   header that is fixed length. */
54
55typedef struct nlm_internal_fixed_header
56{
57  /* The signature field identifies the file as an NLM.  It must contain
58     the signature string, which depends upon the NLM target. */
59
60  char signature[NLM_SIGNATURE_SIZE];
61
62  /* The version of the header.  At this time, the highest version number
63     is 4. */
64
65  long version;
66
67  /* The name of the module, which must be a DOS name (1-8 characters followed
68     by a period and a 1-3 character extension.  The first byte is the byte
69     length of the name and the last byte is a null terminator byte.  This
70     field is fixed length, and any unused bytes should be null bytes.  The
71     value is set by the OUTPUT keyword to NLMLINK. */
72
73  char moduleName[NLM_MODULE_NAME_SIZE];
74
75  /* The byte offset of the code image from the start of the file. */
76
77  file_ptr codeImageOffset;
78
79  /* The size of the code image, in bytes. */
80
81  bfd_size_type codeImageSize;
82
83  /* The byte offset of the data image from the start of the file. */
84
85  file_ptr dataImageOffset;
86
87  /* The size of the data image, in bytes. */
88
89  bfd_size_type dataImageSize;
90
91  /* The size of the uninitialized data region that the loader is to be
92     allocated at load time.  Uninitialized data follows the initialized
93     data in the NLM address space. */
94
95  bfd_size_type uninitializedDataSize;
96
97  /* The byte offset of the custom data from the start of the file.  The
98     custom data is set by the CUSTOM keyword to NLMLINK. */
99
100  file_ptr customDataOffset;
101
102  /* The size of the custom data, in bytes. */
103
104  bfd_size_type customDataSize;
105
106  /* The byte offset of the module dependencies from the start of the file.
107     The module dependencies are determined by the MODULE keyword in
108     NLMLINK. */
109
110  file_ptr moduleDependencyOffset;
111
112  /* The number of module dependencies at the moduleDependencyOffset. */
113
114  long numberOfModuleDependencies;
115
116  /* The byte offset of the relocation fixup data from the start of the file */
117
118  file_ptr relocationFixupOffset;
119  long numberOfRelocationFixups;
120  file_ptr externalReferencesOffset;
121  long numberOfExternalReferences;
122  file_ptr publicsOffset;
123  long numberOfPublics;
124  file_ptr debugInfoOffset;
125  long numberOfDebugRecords;
126  file_ptr codeStartOffset;
127  file_ptr exitProcedureOffset;
128  file_ptr checkUnloadProcedureOffset;
129  long moduleType;
130  long flags;
131} Nlm_Internal_Fixed_Header;
132
133#define nlm32_internal_fixed_header nlm_internal_fixed_header
134#define Nlm32_Internal_Fixed_Header Nlm_Internal_Fixed_Header
135#define nlm64_internal_fixed_header nlm_internal_fixed_header
136#define Nlm64_Internal_Fixed_Header Nlm_Internal_Fixed_Header
137
138/* This structure contains the portions of the NLM header that are either
139   variable in size in the external representation, or else are not at a
140   fixed offset relative to the start of the NLM header due to preceding
141   variable sized fields.
142
143   Note that all the fields must exist in the external header, and in
144   the order used here (the same order is used in the internal form
145   for consistency, not out of necessity). */
146
147typedef struct nlm_internal_variable_header
148{
149
150  /* The descriptionLength field contains the length of the text in
151     descriptionText, excluding the null terminator.  The descriptionText
152     field contains the NLM description obtained from the DESCRIPTION
153     keyword in NLMLINK plus the null byte terminator.  The descriptionText
154     can be up to NLM_MAX_DESCRIPTION_LENGTH characters. */
155     
156  unsigned char descriptionLength;
157  char descriptionText[NLM_MAX_DESCRIPTION_LENGTH + 1];
158
159  /* The stackSize field contains the size of the stack in bytes, as
160     specified by the STACK or STACKSIZE keyword in NLMLINK.  If no size
161     is specified, the default is NLM_DEFAULT_STACKSIZE. */
162     
163  long stackSize;
164
165  /* The reserved field is included only for completeness.  It should contain
166     zero. */
167
168  long reserved;
169
170  /* This field is fixed length, should contain " LONG" (note leading
171     space), and is unused. */
172
173  char oldThreadName[NLM_OLD_THREAD_NAME_LENGTH];
174
175  /* The screenNameLength field contains the length of the actual text stored
176     in the screenName field, excluding the null byte terminator.  The
177     screenName field contains the screen name as specified by the SCREENNAME
178     keyword in NLMLINK, and can be up to NLM_MAX_SCREEN_NAME_LENGTH
179     characters. */
180
181  unsigned char screenNameLength;
182  char screenName[NLM_MAX_SCREEN_NAME_LENGTH + 1];
183
184  /* The threadNameLength field contains the length of the actual text stored
185     in the threadName field, excluding the null byte terminator.  The
186     threadName field contains the thread name as specified by the THREADNAME
187     keyword in NLMLINK, and can be up to NLM_MAX_THREAD_NAME_LENGTH
188     characters. */
189
190  unsigned char threadNameLength;
191  char threadName[NLM_MAX_THREAD_NAME_LENGTH + 1];
192
193} Nlm_Internal_Variable_Header;
194
195#define nlm32_internal_variable_header nlm_internal_variable_header
196#define Nlm32_Internal_Variable_Header Nlm_Internal_Variable_Header
197#define nlm64_internal_variable_header nlm_internal_variable_header
198#define Nlm64_Internal_Variable_Header Nlm_Internal_Variable_Header
199
200/* The version header is one of the optional auxiliary headers and
201   follows the fixed length and variable length NLM headers. */
202
203typedef struct nlm_internal_version_header
204{
205  /* The header is recognized by "VeRsIoN#" in the stamp field. */
206  char stamp[8];
207  long majorVersion;
208  long minorVersion;
209  long revision;
210  long year;
211  long month;
212  long day;
213} Nlm_Internal_Version_Header;
214
215#define nlm32_internal_version_header nlm_internal_version_header
216#define Nlm32_Internal_Version_Header Nlm_Internal_Version_Header
217#define nlm64_internal_version_header nlm_internal_version_header
218#define Nlm64_Internal_Version_Header Nlm_Internal_Version_Header
219
220typedef struct nlm_internal_copyright_header
221{
222  /* The header is recognized by "CoPyRiGhT=" in the stamp field. */
223  char stamp[10];
224  unsigned char copyrightMessageLength;
225  char copyrightMessage[NLM_MAX_COPYRIGHT_MESSAGE_LENGTH];
226} Nlm_Internal_Copyright_Header;
227
228#define nlm32_internal_copyright_header nlm_internal_copyright_header
229#define Nlm32_Internal_Copyright_Header Nlm_Internal_Copyright_Header
230#define nlm64_internal_copyright_header nlm_internal_copyright_header
231#define Nlm64_Internal_Copyright_Header Nlm_Internal_Copyright_Header
232
233typedef struct nlm_internal_extended_header
234{
235  /* The header is recognized by "MeSsAgEs" in the stamp field. */
236  char stamp[8];
237  long languageID;
238  file_ptr messageFileOffset;
239  bfd_size_type messageFileLength;
240  long messageCount;
241  file_ptr helpFileOffset;
242  bfd_size_type helpFileLength;
243  file_ptr RPCDataOffset;
244  bfd_size_type RPCDataLength;
245  file_ptr sharedCodeOffset;
246  bfd_size_type sharedCodeLength;
247  file_ptr sharedDataOffset;
248  bfd_size_type sharedDataLength;
249  file_ptr sharedRelocationFixupOffset;
250  long sharedRelocationFixupCount;
251  file_ptr sharedExternalReferenceOffset;
252  long sharedExternalReferenceCount;
253  file_ptr sharedPublicsOffset;
254  long sharedPublicsCount;
255  file_ptr sharedDebugRecordOffset;
256  long sharedDebugRecordCount;
257  bfd_vma SharedInitializationOffset;
258  bfd_vma SharedExitProcedureOffset;
259  long productID;
260  long reserved0;
261  long reserved1;
262  long reserved2;
263  long reserved3;
264  long reserved4;
265  long reserved5;
266} Nlm_Internal_Extended_Header;
267
268#define nlm32_internal_extended_header nlm_internal_extended_header
269#define Nlm32_Internal_Extended_Header Nlm_Internal_Extended_Header
270#define nlm64_internal_extended_header nlm_internal_extended_header
271#define Nlm64_Internal_Extended_Header Nlm_Internal_Extended_Header
272
273/* The format of a custom header as stored internally is different
274   from the external format.  This is how we store a custom header
275   which we do not recognize.  */
276
277typedef struct nlm_internal_custom_header
278{
279  /* The header is recognized by "CuStHeAd" in the stamp field. */
280  char stamp[8];
281  bfd_size_type hdrLength;
282  file_ptr dataOffset;
283  bfd_size_type dataLength;
284  char dataStamp[8];
285  void *hdr;
286} Nlm_Internal_Custom_Header;
287
288#define nlm32_internal_custom_header nlm_internal_custom_header
289#define Nlm32_Internal_Custom_Header Nlm_Internal_Custom_Header
290#define nlm64_internal_custom_header nlm_internal_custom_header
291#define Nlm64_Internal_Custom_Header Nlm_Internal_Custom_Header
292
293/* The internal Cygnus header is written out externally as a custom
294   header.  We don't try to replicate that structure here.  */
295
296typedef struct nlm_internal_cygnus_ext_header
297{
298  /* The header is recognized by "CyGnUsEx" in the stamp field. */
299  char stamp[8];
300  /* File location of debugging information.  */
301  file_ptr offset;
302  /* Length of debugging information.  */
303  bfd_size_type length;
304} Nlm_Internal_Cygnus_Ext_Header;
305
306#define nlm32_internal_cygnus_ext_header nlm_internal_cygnus_ext_header
307#define Nlm32_Internal_Cygnus_Ext_Header Nlm_Internal_Cygnus_Ext_Header
308#define nlm64_internal_cygnus_ext_header nlm_internal_cygnus_ext_header
309#define Nlm64_Internal_Cygnus_Ext_Header Nlm_Internal_Cygnus_Ext_Header
Note: See TracBrowser for help on using the repository browser.