1 | /* defs.h -- Various definitions for emx development utilities
|
---|
2 | Copyright (c) 1992-1998 Eberhard Mattes
|
---|
3 |
|
---|
4 | This file is part of emx.
|
---|
5 |
|
---|
6 | emx is free software; you can redistribute it and/or modify
|
---|
7 | it under the terms of the GNU General Public License as published by
|
---|
8 | the Free Software Foundation; either version 2, or (at your option)
|
---|
9 | any later version.
|
---|
10 |
|
---|
11 | emx is distributed in the hope that it will be useful,
|
---|
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
14 | GNU General Public License for more details.
|
---|
15 |
|
---|
16 | You should have received a copy of the GNU General Public License
|
---|
17 | along with emx; see the file COPYING. If not, write to
|
---|
18 | the Free Software Foundation, 59 Temple Place - Suite 330,
|
---|
19 | Boston, MA 02111-1307, USA. */
|
---|
20 |
|
---|
21 |
|
---|
22 | #define FALSE 0
|
---|
23 | #define TRUE 1
|
---|
24 |
|
---|
25 | #ifdef __GNUC__
|
---|
26 | #define NORETURN2 __attribute__ ((noreturn))
|
---|
27 | #define ATTR_PRINTF(s,f) __attribute__ ((__format__ (__printf__, s, f)))
|
---|
28 | #else
|
---|
29 | #define NORETURN2
|
---|
30 | #define ATTR_PRINTF(s,f)
|
---|
31 | #endif
|
---|
32 |
|
---|
33 | /* The magic number that is always the first DWORD in .data,
|
---|
34 | followed by a offset to the __os2dll set. */
|
---|
35 | #define DATASEG_MAGIC 0xba0bab
|
---|
36 |
|
---|
37 | /* The maximum OMF record size supported by OMF linkers. This value
|
---|
38 | includes the record type, length and checksum fields. */
|
---|
39 | #define MAX_REC_SIZE 1024
|
---|
40 |
|
---|
41 | #ifndef _BYTE_WORD_DWORD
|
---|
42 | #define _BYTE_WORD_DWORD
|
---|
43 | typedef unsigned char byte;
|
---|
44 | typedef unsigned short word;
|
---|
45 | typedef unsigned long dword;
|
---|
46 | #endif /* _BYTE_WORD_DWORD */
|
---|
47 |
|
---|
48 | /* This is the header of a DOS executable file. */
|
---|
49 | struct exe1_header
|
---|
50 | {
|
---|
51 | word magic; /* Magic number, "MZ" (0x5a4d) */
|
---|
52 | word last_page; /* Number of bytes in last page */
|
---|
53 | word pages; /* Size of the file in 512-byte pages */
|
---|
54 | word reloc_size; /* Number of relocation entries */
|
---|
55 | word hdr_size; /* Size of header in 16-byte paragraphs */
|
---|
56 | word min_alloc; /* Minimum allocation (paragraphs) */
|
---|
57 | word max_alloc; /* Maximum allocation (paragraphs) */
|
---|
58 | word ss, sp; /* Initial stack pointer */
|
---|
59 | word chksum; /* Checksum */
|
---|
60 | word ip, cs; /* Entry point */
|
---|
61 | word reloc_ptr; /* Location of the relocation table */
|
---|
62 | word ovl; /* Overlay number */
|
---|
63 | };
|
---|
64 |
|
---|
65 | /* This is an additional header of a DOS executable file. It contains
|
---|
66 | a pointer to the new EXE header. */
|
---|
67 | struct exe2_header
|
---|
68 | {
|
---|
69 | word res1[16]; /* Reserved */
|
---|
70 | word new_lo; /* Low word of the location of the header */
|
---|
71 | word new_hi; /* High word of the location of the header */
|
---|
72 | };
|
---|
73 |
|
---|
74 | /* This is the layout of the OS/2 LX header. */
|
---|
75 | struct os2_header
|
---|
76 | {
|
---|
77 | word magic; /* Magic number, "LX" (0x584c) */
|
---|
78 | byte byte_order; /* Byte order */
|
---|
79 | byte word_order; /* Word order */
|
---|
80 | dword level; /* Format level */
|
---|
81 | word cpu; /* CPU type */
|
---|
82 | word os; /* Operating system type */
|
---|
83 | dword ver; /* Module version */
|
---|
84 | dword mod_flags; /* Module flags */
|
---|
85 | dword mod_pages; /* Number of pages in the EXE file */
|
---|
86 | dword entry_obj; /* Object number for EIP */
|
---|
87 | dword entry_eip; /* Entry point */
|
---|
88 | dword stack_obj; /* Object number for ESP */
|
---|
89 | dword stack_esp; /* Stack */
|
---|
90 | dword pagesize; /* System page size */
|
---|
91 | dword pageshift; /* Page offset shift */
|
---|
92 | dword fixup_size; /* Fixup section size */
|
---|
93 | dword fixup_checksum; /* Fixup section checksum */
|
---|
94 | dword loader_size; /* Loader section size */
|
---|
95 | dword loader_checksum; /* Loader section checksum */
|
---|
96 | dword obj_offset; /* Object table offset */
|
---|
97 | dword obj_count; /* Number of objects in module */
|
---|
98 | dword pagemap_offset; /* Object page table offset */
|
---|
99 | dword itermap_offset; /* Object iterated pages offset */
|
---|
100 | dword rsctab_offset; /* Resource table offset */
|
---|
101 | dword rsctab_count; /* Number of resource table entries */
|
---|
102 | dword resname_offset; /* Resident name table offset */
|
---|
103 | dword entry_offset; /* Entry table offset */
|
---|
104 | dword moddir_offset; /* Module directives offset */
|
---|
105 | dword moddir_count; /* Number of module directives */
|
---|
106 | dword fixpage_offset; /* Fixup page table offset */
|
---|
107 | dword fixrecord_offset; /* Fixup record table offset */
|
---|
108 | dword impmod_offset; /* Import module table offset */
|
---|
109 | dword impmod_count; /* Number of import module table entries */
|
---|
110 | dword impprocname_offset; /* Import procedure table offset */
|
---|
111 | dword page_checksum_offset; /* Per page checksum table offset */
|
---|
112 | dword enum_offset; /* Data pages offset */
|
---|
113 | dword preload_count; /* Number of preload pages */
|
---|
114 | dword nonresname_offset; /* Non-resident name table offset */
|
---|
115 | dword nonresname_size; /* Non-resident name table size */
|
---|
116 | dword nonresname_checksum; /* Non-resident name table checksum */
|
---|
117 | dword auto_obj; /* Auto data segment object number */
|
---|
118 | dword debug_offset; /* Debug information offset */
|
---|
119 | dword debug_size; /* Debug information size */
|
---|
120 | dword instance_preload; /* Number of instance preload pages */
|
---|
121 | dword instance_demand; /* Number of instance load-on-demand pages */
|
---|
122 | dword heap_size; /* Heap size */
|
---|
123 | dword stack_size; /* Stack size */
|
---|
124 | dword reserved[5]; /* Reserved */
|
---|
125 | };
|
---|
126 |
|
---|
127 | /* This is the layout of an object table entry. */
|
---|
128 | struct object
|
---|
129 | {
|
---|
130 | dword virt_size; /* Virtual size */
|
---|
131 | dword virt_base; /* Relocation base address */
|
---|
132 | dword attr_flags; /* Object attributes and flags */
|
---|
133 | dword map_first; /* Page table index */
|
---|
134 | dword map_count; /* Number of page table entries */
|
---|
135 | dword reserved; /* Reserved */
|
---|
136 | };
|
---|
137 |
|
---|
138 | #pragma pack(1)
|
---|
139 |
|
---|
140 | struct omf_rec
|
---|
141 | {
|
---|
142 | byte rec_type;
|
---|
143 | word rec_len;
|
---|
144 | };
|
---|
145 |
|
---|
146 | #pragma pack()
|
---|