1987-03-09 21:20:21 +00:00
|
|
|
/*
|
|
|
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
|
|
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
|
|
|
*/
|
1994-06-24 11:31:16 +00:00
|
|
|
/* $Id$ */
|
1990-10-25 11:18:44 +00:00
|
|
|
|
|
|
|
#ifndef __OUT_H_INCLUDED
|
|
|
|
#define __OUT_H_INCLUDED
|
2012-09-27 09:54:41 +00:00
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
1985-01-10 13:35:39 +00:00
|
|
|
/*
|
|
|
|
* output format for ACK assemblers
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct outhead {
|
2012-09-27 09:54:41 +00:00
|
|
|
uint16_t oh_magic; /* magic number */
|
|
|
|
uint16_t oh_stamp; /* version stamp */
|
|
|
|
uint16_t oh_flags; /* several format flags */
|
|
|
|
uint16_t oh_nsect; /* number of outsect structures */
|
|
|
|
uint16_t oh_nrelo; /* number of outrelo structures */
|
|
|
|
uint16_t oh_nname; /* number of outname structures */
|
|
|
|
uint32_t oh_nemit; /* sum of all os_flen */
|
|
|
|
uint32_t oh_nchar; /* size of string area */
|
1985-01-10 13:35:39 +00:00
|
|
|
};
|
|
|
|
|
1991-12-12 14:15:14 +00:00
|
|
|
#define O_MAGIC 0x0201 /* magic number of output file */
|
|
|
|
#define O_STAMP 0 /* version stamp */
|
|
|
|
#define MAXSECT 64 /* Maximum number of sections */
|
1985-01-10 13:35:39 +00:00
|
|
|
|
1991-12-12 14:15:14 +00:00
|
|
|
#define HF_LINK 0x0004 /* unresolved references left */
|
|
|
|
#define HF_8086 0x0008 /* os_base specially encoded */
|
1985-01-10 13:35:39 +00:00
|
|
|
|
|
|
|
struct outsect {
|
2012-09-27 09:54:41 +00:00
|
|
|
uint32_t os_base; /* startaddress in machine */
|
|
|
|
uint32_t os_size; /* section size in machine */
|
|
|
|
uint32_t os_foff; /* startaddress in file */
|
|
|
|
uint32_t os_flen; /* section size in file */
|
|
|
|
uint32_t os_lign; /* section alignment */
|
1985-01-10 13:35:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct outrelo {
|
2012-09-27 09:54:41 +00:00
|
|
|
int8_t or_type; /* type of reference */
|
|
|
|
int8_t or_sect; /* referencing section */
|
|
|
|
uint16_t or_nami; /* referenced symbol index */
|
|
|
|
uint32_t or_addr; /* referencing address */
|
1985-01-10 13:35:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct outname {
|
|
|
|
union {
|
2012-09-27 09:54:41 +00:00
|
|
|
int8_t *on_ptr; /* symbol name (in core) */
|
|
|
|
uint32_t on_off; /* symbol name (in file) */
|
1985-01-10 13:35:39 +00:00
|
|
|
} on_u;
|
|
|
|
#define on_mptr on_u.on_ptr
|
|
|
|
#define on_foff on_u.on_off
|
2012-09-27 09:54:41 +00:00
|
|
|
uint16_t on_type; /* symbol type */
|
|
|
|
uint16_t on_desc; /* debug info */
|
|
|
|
uint32_t on_valu; /* symbol value */
|
1985-01-10 13:35:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* relocation type bits
|
|
|
|
*/
|
1991-12-12 14:15:14 +00:00
|
|
|
#define RELSZ 0x07 /* relocation length */
|
|
|
|
#define RELO1 1 /* 1 byte */
|
|
|
|
#define RELO2 2 /* 2 bytes */
|
|
|
|
#define RELO4 4 /* 4 bytes */
|
|
|
|
#define RELPC 0x08 /* pc relative */
|
|
|
|
#define RELBR 0x10 /* High order byte lowest address. */
|
|
|
|
#define RELWR 0x20 /* High order word lowest address. */
|
1985-01-10 13:35:39 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* section type bits and fields
|
|
|
|
*/
|
1991-12-12 14:15:14 +00:00
|
|
|
#define S_TYP 0x007F /* undefined, absolute or relative */
|
|
|
|
#define S_EXT 0x0080 /* external flag */
|
|
|
|
#define S_ETC 0x7F00 /* for symbolic debug, bypassing 'as' */
|
1985-01-10 13:35:39 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* S_TYP field values
|
|
|
|
*/
|
1991-12-12 14:15:14 +00:00
|
|
|
#define S_UND 0x0000 /* undefined item */
|
|
|
|
#define S_ABS 0x0001 /* absolute item */
|
|
|
|
#define S_MIN 0x0002 /* first user section */
|
|
|
|
#define S_MAX (S_TYP-1) /* last user section */
|
|
|
|
#define S_CRS S_TYP /* on_valu is symbol index which contains value */
|
1985-01-10 13:35:39 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* S_ETC field values
|
|
|
|
*/
|
1991-12-12 14:15:14 +00:00
|
|
|
#define S_SCT 0x0100 /* section names */
|
|
|
|
#define S_LIN 0x0200 /* hll source line item */
|
|
|
|
#define S_FIL 0x0300 /* hll source file item */
|
|
|
|
#define S_MOD 0x0400 /* ass source file item */
|
|
|
|
#define S_COM 0x1000 /* Common name. */
|
|
|
|
#define S_STB 0xe000 /* entries with any of these bits set are
|
|
|
|
reserved for debuggers
|
|
|
|
*/
|
1985-01-10 13:35:39 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* structure format strings
|
|
|
|
*/
|
|
|
|
#define SF_HEAD "22222244"
|
|
|
|
#define SF_SECT "44444"
|
|
|
|
#define SF_RELO "1124"
|
|
|
|
#define SF_NAME "4224"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* structure sizes (bytes in file; add digits in SF_*)
|
|
|
|
*/
|
|
|
|
#define SZ_HEAD 20
|
|
|
|
#define SZ_SECT 20
|
|
|
|
#define SZ_RELO 8
|
|
|
|
#define SZ_NAME 12
|
|
|
|
|
|
|
|
/*
|
|
|
|
* file access macros
|
|
|
|
*/
|
|
|
|
#define BADMAGIC(x) ((x).oh_magic!=O_MAGIC)
|
|
|
|
#define OFF_SECT(x) SZ_HEAD
|
2012-09-27 09:54:41 +00:00
|
|
|
#define OFF_EMIT(x) (OFF_SECT(x) + ((uint32_t)(x).oh_nsect * SZ_SECT))
|
1985-01-10 13:35:39 +00:00
|
|
|
#define OFF_RELO(x) (OFF_EMIT(x) + (x).oh_nemit)
|
2012-09-27 09:54:41 +00:00
|
|
|
#define OFF_NAME(x) (OFF_RELO(x) + ((uint32_t)(x).oh_nrelo * SZ_RELO))
|
|
|
|
#define OFF_CHAR(x) (OFF_NAME(x) + ((uint32_t)(x).oh_nname * SZ_NAME))
|
1990-10-25 11:18:44 +00:00
|
|
|
|
|
|
|
#endif /* __OUT_H_INCLUDED */
|