source: umon/main/common/coff.h @ 87db514

Last change on this file since 87db514 was 87db514, checked in by Amar Takhar <amar@…>, on 04/16/15 at 19:26:21

Initial commit of the umon repository.

Prior to this three changes were made:

  • Remove umon_ prefix from parent directories.
  • Collapse main/target/ into main/
  • Remove ports/template/flashtest.scr.ucon script.
  • Property mode set to 100644
File size: 3.7 KB
Line 
1/**************************************************************************
2 *
3 * Copyright (c) 2013 Alcatel-Lucent
4 *
5 * Alcatel Lucent licenses this file to You under the Apache License,
6 * Version 2.0 (the "License"); you may not use this file except in
7 * compliance with the License.  A copy of the License is contained the
8 * file LICENSE at the top level of this repository.
9 * You may also obtain a copy of the License at:
10 *
11 *      http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 *
19 **************************************************************************
20 *
21 * coff.h:
22 *
23 * Header file used for the COFF file format of TFS.
24 *
25 * Original author:     Ed Sutter (ed.sutter@alcatel-lucent.com)
26 *
27 */
28#ifndef _COFF_H_
29#define _COFF_H_
30
31/* File header... */
32struct filehdr {
33        unsigned short  f_magic;        /* magic number */
34        unsigned short  f_nscns;        /* number of sections */
35        long                    f_timdat;       /* time & date stamp */
36        long                    f_symptr;       /* file pointer to symtab */
37        long                    f_nsyms;        /* number of symtab entries */
38        unsigned short  f_opthdr;       /* sizeof(optional hdr) */
39        unsigned short  f_flags;        /* flags */
40};
41
42#define FILHDR  struct filehdr
43#define FILHSZ  sizeof(FILHDR)
44#define F_EXEC  0000002
45
46/* Optional header... */
47struct aouthdr {
48        short   magic; 
49        short   vstamp;         /* version stamp                        */
50        long    tsize;          /* text size in bytes, padded to FW
51                                                   bdry                                 */
52        long    dsize;          /* initialized data "  "                */
53        long    bsize;          /* uninitialized data "   "             */
54        long    entry;          /* entry pt.                            */
55        long    text_start;     /* base of text used for this file      */
56        long    data_start;     /* base of data used for this file      */
57};
58
59#define AOUTHDR struct aouthdr
60#define AOUTHSZ sizeof(AOUTHDR)
61
62struct scnhdr {
63        char            s_name[8];      /* section name */
64        long            s_paddr;        /* physical address */
65        long            s_vaddr;        /* virtual address */
66        long            s_size;         /* section size */
67        long            s_scnptr;       /* file ptr to raw data for section */
68        long            s_relptr;       /* file ptr to relocation */
69        long            s_lnnoptr;      /* file ptr to line numbers */
70        unsigned short  s_nreloc;       /* number of relocation entries */
71        unsigned short  s_nlnno;        /* number of line number entries */
72        long            s_flags;        /* flags */
73};
74
75#define SCNHDR  struct scnhdr
76#define SCNHSZ  sizeof(SCNHDR)
77
78/*
79 * The low 4 bits of s_flags is used as a section "type"
80 */
81
82#define STYP_REG        0x00            /* "regular" section:
83                                                                        allocated, relocated, loaded */
84#define STYP_DSECT      0x01            /* "dummy" section:
85                                                                        not allocated, relocated,
86                                                                        not loaded */
87#define STYP_NOLOAD     0x02            /* "noload" section:
88                                                                        allocated, relocated,
89                                                                         not loaded */
90#define STYP_GROUP      0x04            /* "grouped" section:
91                                                                        formed of input sections */
92#define STYP_PAD        0x08            /* "padding" section:
93                                                                        not allocated, not relocated,
94                                                                         loaded */
95#define STYP_COPY       0x10            /* "copy" section:
96                                                                        for decision function used
97                                                                        by field update;  not
98                                                                        allocated, not relocated,
99                                                                        loaded;  reloc & lineno
100                                                                        entries processed normally */
101#define STYP_TEXT       0x20            /* section contains text only */
102#define STYP_DATA       0x40            /* section contains data only */
103#define STYP_BSS        0x80            /* section contains bss only */
104#define STYP_INFO       0x0200
105#define STYP_LIT        0x8020
106#define STYP_ABS        0x4000
107#define STYP_BSSREG     0x1200
108#define STYP_ENVIR      0x2200
109
110#define ISLOADABLE(flags) \
111        (flags & (STYP_ABS | STYP_TEXT | STYP_LIT | STYP_DATA))
112#define ISBSS(flags) (flags & (STYP_BSS))
113#define ISTEXT(flags) (flags & (STYP_TEXT))
114#endif
Note: See TracBrowser for help on using the repository browser.