1 #ifndef COFF_H
2 #define COFF_H
3 /* Based on the elf.h file
4  * Changed accordingly to support COFF file support
5  */
6 
7 
8 /* Values for f_flags. */
9 #define F_RELFLG	0x0001 	/* If set, not reloc. info. Clear for executables */
10 #define F_EXEC		0x0002	/* No unresolved symbols. Executable file ! */
11 #define F_LNNO		0x0004	/* If set, line information numbers removed  */
12 #define F_LSYMS		0x0008	/* If set, local symbols removed  */
13 #define F_AR32WR	0x0100	/* Indicates little endian file */
14 
15 /* Values for e_machine (architecute). */
16 #define EM_E1		0x17a 	/* Magic number for Hyperstone. Big endian format */
17 
18 /* Values for f_flags. */
19 #define	O_MAGIC		0x017c	/* Optional's header magic number for Hyperstone */
20 
21 /* Values for s_flags. */
22 #define S_TYPE_TEXT	0x0020 	/* If set, the section contains only executable */
23 #define S_TYPE_DATA	0x0040 	/* If set, the section contains only initialized data */
24 #define S_TYPE_BSS	0x0080 	/* If set, the section is BSS no data stored */
25 
26 
27 typedef struct
28 {
29 	unsigned short 	f_magic;	/* magic number				*/
30 	unsigned short 	f_nscns;	/* number of sections		*/
31 	unsigned long 	f_timdat;	/* time & date stamp		*/
32 	unsigned long 	f_symptr;	/* file pointer to symtab	*/
33 	unsigned long 	f_nsyms;	/* number of symtab entries	*/
34 	unsigned short	f_opthdr;	/* sizeof(optional hdr)		*/
35 	unsigned short 	f_flags;	/* flags					*/
36 }
37 COFF_filehdr;
38 
39 /*
40  * Optional header.
41  */
42 typedef struct
43 {
44   unsigned short	magic;		/* type of file				*/
45   unsigned short	vstamp;		/* version stamp			*/
46   unsigned long		tsize;		/* text size in bytes, padded to FW bdry*/
47   unsigned long		dsize;		/* initialized data "  "		*/
48   unsigned long		bsize;		/* uninitialized data "   "		*/
49   unsigned long		entry;		/* entry pt.				*/
50   unsigned long		text_start;	/* base of text used for this file */
51   unsigned long 	data_start;	/* base of data used for this file */
52 }
53 COFF_opthdr;
54 
55 /*
56  * Section header.
57  */
58 typedef struct
59 {
60 	char				s_name[8];	/* section name			*/
61 	unsigned long		s_paddr;	/* physical address, aliased s_nlib */
62 	unsigned long		s_vaddr;	/* virtual address		*/
63 	unsigned long		s_size;		/* section size			*/
64 	unsigned long		s_scnptr;	/* file ptr to raw data for section */
65 	unsigned long		s_relptr;	/* file ptr to relocation	*/
66 	unsigned long		s_lnnoptr;	/* file ptr to line numbers	*/
67 	unsigned short		s_nreloc;	/* number of relocation entries	*/
68 	unsigned short		s_nlnno;	/* number of line number entries*/
69 	unsigned long		s_flags;	/* flags			*/
70 }
71 COFF_scnhdr;
72 
73 #endif /* COFF_H */
74