source: trunk/minix/commands/aal/out.h@ 9

Last change on this file since 9 was 9, checked in by Mattia Monga, 13 years ago

Minix 3.1.2a

File size: 3.5 KB
Line 
1/*
2 * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
3 * See the copyright notice in the ACK home directory, in the file "Copyright".
4 */
5/* $Header: /cvsup/minix/src/commands/aal/out.h,v 1.1.1.1 2005/04/21 14:53:57 beng Exp $ */
6
7#ifndef __OUT_H_INCLUDED
8#define __OUT_H_INCLUDED
9/*
10 * output format for ACK assemblers
11 */
12#ifndef ushort
13#define ushort unsigned short
14#endif /* ushort */
15
16struct outhead {
17 ushort oh_magic; /* magic number */
18 ushort oh_stamp; /* version stamp */
19 ushort oh_flags; /* several format flags */
20 ushort oh_nsect; /* number of outsect structures */
21 ushort oh_nrelo; /* number of outrelo structures */
22 ushort oh_nname; /* number of outname structures */
23 long oh_nemit; /* sum of all os_flen */
24 long oh_nchar; /* size of string area */
25};
26
27#define O_MAGIC 0x0201 /* magic number of output file */
28#define O_STAMP 0 /* version stamp */
29#define MAXSECT 64 /* Maximum number of sections */
30
31#define HF_LINK 0x0004 /* unresolved references left */
32#define HF_8086 0x0008 /* os_base specially encoded */
33
34struct outsect {
35 long os_base; /* startaddress in machine */
36 long os_size; /* section size in machine */
37 long os_foff; /* startaddress in file */
38 long os_flen; /* section size in file */
39 long os_lign; /* section alignment */
40};
41
42struct outrelo {
43 char or_type; /* type of reference */
44 char or_sect; /* referencing section */
45 ushort or_nami; /* referenced symbol index */
46 long or_addr; /* referencing address */
47};
48
49struct outname {
50 union {
51 char *on_ptr; /* symbol name (in core) */
52 long on_off; /* symbol name (in file) */
53 } on_u;
54#define on_mptr on_u.on_ptr
55#define on_foff on_u.on_off
56 ushort on_type; /* symbol type */
57 ushort on_desc; /* debug info */
58 long on_valu; /* symbol value */
59};
60
61/*
62 * relocation type bits
63 */
64#define RELSZ 0x07 /* relocation length */
65#define RELO1 1 /* 1 byte */
66#define RELO2 2 /* 2 bytes */
67#define RELO4 4 /* 4 bytes */
68#define RELPC 0x08 /* pc relative */
69#define RELBR 0x10 /* High order byte lowest address. */
70#define RELWR 0x20 /* High order word lowest address. */
71
72/*
73 * section type bits and fields
74 */
75#define S_TYP 0x007F /* undefined, absolute or relative */
76#define S_EXT 0x0080 /* external flag */
77#define S_ETC 0x7F00 /* for symbolic debug, bypassing 'as' */
78
79/*
80 * S_TYP field values
81 */
82#define S_UND 0x0000 /* undefined item */
83#define S_ABS 0x0001 /* absolute item */
84#define S_MIN 0x0002 /* first user section */
85#define S_MAX (S_TYP-1) /* last user section */
86#define S_CRS S_TYP /* on_valu is symbol index which contains value */
87
88/*
89 * S_ETC field values
90 */
91#define S_SCT 0x0100 /* section names */
92#define S_LIN 0x0200 /* hll source line item */
93#define S_FIL 0x0300 /* hll source file item */
94#define S_MOD 0x0400 /* ass source file item */
95#define S_COM 0x1000 /* Common name. */
96#define S_STB 0xe000 /* entries with any of these bits set are
97 reserved for debuggers
98 */
99
100/*
101 * structure format strings
102 */
103#define SF_HEAD "22222244"
104#define SF_SECT "44444"
105#define SF_RELO "1124"
106#define SF_NAME "4224"
107
108/*
109 * structure sizes (bytes in file; add digits in SF_*)
110 */
111#define SZ_HEAD 20
112#define SZ_SECT 20
113#define SZ_RELO 8
114#define SZ_NAME 12
115
116/*
117 * file access macros
118 */
119#define BADMAGIC(x) ((x).oh_magic!=O_MAGIC)
120#define OFF_SECT(x) SZ_HEAD
121#define OFF_EMIT(x) (OFF_SECT(x) + ((long)(x).oh_nsect * SZ_SECT))
122#define OFF_RELO(x) (OFF_EMIT(x) + (x).oh_nemit)
123#define OFF_NAME(x) (OFF_RELO(x) + ((long)(x).oh_nrelo * SZ_RELO))
124#define OFF_CHAR(x) (OFF_NAME(x) + ((long)(x).oh_nname * SZ_NAME))
125
126#endif /* __OUT_H_INCLUDED */
Note: See TracBrowser for help on using the repository browser.