xref: /netbsd-src/sys/arch/x68k/stand/aout2hux/aout68k.h (revision 3b435a73967be44dfb4a27315acd72bfacde430c)
1 /*
2  *	a.out file structure definitions
3  *
4  *	written by Yasha (ITOH Yasufumi)
5  *	public domain
6  *
7  *	$NetBSD: aout68k.h,v 1.1 1998/09/01 19:51:08 itohy Exp $
8  */
9 /*
10  * NetBSD/m68k a.out format (OMAGIC, NMAGIC)
11  *
12  *	----------------------------
13  *	|  file header (32 bytes)  |
14  *	|--------------------------|
15  *	|  text                    |
16  *	|--------------------------|
17  *	|  data                    |
18  *	|--------------------------|
19  *	|  text relocation table   |
20  *	|--------------------------|
21  *	|  data relocation table   |
22  *	|--------------------------|
23  *	|  symbol table            |
24  *	|--------------------------|
25  *	|  string table            |
26  *	----------------------------
27  *
28  * OMAGIC: text and data segments are loaded contiguous
29  * NMAGIC: data segment is loaded at the next page of the text
30  */
31 
32 struct aout_m68k {
33 	be_uint32_t	a_magic;	/* encoded magic number */
34 	be_uint32_t	a_text;		/* size of text section */
35 	be_uint32_t	a_data;		/* size of data section */
36 	be_uint32_t	a_bss;		/* size of bss */
37 	be_uint32_t	a_syms;		/* size of symbol table */
38 	be_uint32_t	a_entry;	/* entry point address */
39 	be_uint32_t	a_trsize;	/* size of text relocation */
40 	be_uint32_t	a_drsize;	/* size of data relocation */
41 };
42 
43 #define AOUT_GET_MAGIC(e)	(((e)->a_magic.val[2]<<8) | (e)->a_magic.val[3])
44 #define	AOUT_OMAGIC	0407
45 #define	AOUT_NMAGIC	0410
46 #define	AOUT_ZMAGIC	0413	/* demand paging --- header is in the text */
47 
48 #define AOUT_GET_FLAGS(e)	((e)->a_magic.val[0] >> 2)
49 #define AOUT_FLAG_PIC		0x10
50 #define AOUT_FLAG_DYNAMIC	0x20
51 
52 /* machine ID */
53 #define AOUT_GET_MID(e)		((((e)->a_magic.val[0] & 0x03) << 8) |	\
54 					(e)->a_magic.val[1])
55 #define	AOUT_MID_M68K	135	/* m68k BSD binary, 8KB page */
56 #define	AOUT_MID_M68K4K	136	/* m68k BSD binary, 4KB page */
57 
58 #define AOUT_PAGESIZE(e)	(AOUT_GET_MAGIC(e) == AOUT_OMAGIC ? 1 :	\
59 				AOUT_GET_MID(e) == AOUT_MID_M68K ? 8192 : 4096)
60