Statistics
| Branch: | Revision:

root / linux-user / flat.h @ cb33da57

History | View | Annotate | Download (2.5 kB)

1 e5fe0c52 pbrook
/*
2 e5fe0c52 pbrook
 * Copyright (C) 2002-2003  David McCullough <davidm@snapgear.com>
3 e5fe0c52 pbrook
 * Copyright (C) 1998       Kenneth Albanowski <kjahds@kjahds.com>
4 e5fe0c52 pbrook
 *                          The Silver Hammer Group, Ltd.
5 e5fe0c52 pbrook
 *
6 e5fe0c52 pbrook
 * This file provides the definitions and structures needed to
7 e5fe0c52 pbrook
 * support uClinux flat-format executables.
8 e5fe0c52 pbrook
 */
9 e5fe0c52 pbrook
10 e5fe0c52 pbrook
#define        FLAT_VERSION                        0x00000004L
11 e5fe0c52 pbrook
12 e5fe0c52 pbrook
#ifdef CONFIG_BINFMT_SHARED_FLAT
13 e5fe0c52 pbrook
#define        MAX_SHARED_LIBS                        (4)
14 e5fe0c52 pbrook
#else
15 e5fe0c52 pbrook
#define        MAX_SHARED_LIBS                        (1)
16 e5fe0c52 pbrook
#endif
17 e5fe0c52 pbrook
18 e5fe0c52 pbrook
/*
19 e5fe0c52 pbrook
 * To make everything easier to port and manage cross platform
20 e5fe0c52 pbrook
 * development,  all fields are in network byte order.
21 e5fe0c52 pbrook
 */
22 e5fe0c52 pbrook
23 e5fe0c52 pbrook
struct flat_hdr {
24 e5fe0c52 pbrook
        char magic[4];
25 223b8a40 pbrook
        target_ulong rev;          /* version (as above) */
26 223b8a40 pbrook
        target_ulong entry;        /* Offset of first executable instruction
27 e5fe0c52 pbrook
                                       with text segment from beginning of file */
28 223b8a40 pbrook
        target_ulong data_start;   /* Offset of data segment from beginning of
29 e5fe0c52 pbrook
                                       file */
30 223b8a40 pbrook
        target_ulong data_end;     /* Offset of end of data segment
31 e5fe0c52 pbrook
                                       from beginning of file */
32 223b8a40 pbrook
        target_ulong bss_end;      /* Offset of end of bss segment from beginning
33 e5fe0c52 pbrook
                                       of file */
34 e5fe0c52 pbrook
35 e5fe0c52 pbrook
        /* (It is assumed that data_end through bss_end forms the bss segment.) */
36 e5fe0c52 pbrook
37 223b8a40 pbrook
        target_ulong stack_size;   /* Size of stack, in bytes */
38 223b8a40 pbrook
        target_ulong reloc_start;  /* Offset of relocation records from
39 e5fe0c52 pbrook
                                       beginning of file */
40 223b8a40 pbrook
        target_ulong reloc_count;  /* Number of relocation records */
41 3b46e624 ths
        target_ulong flags;
42 223b8a40 pbrook
        target_ulong build_date;   /* When the program/library was built */
43 223b8a40 pbrook
        target_ulong filler[5];    /* Reservered, set to zero */
44 e5fe0c52 pbrook
};
45 e5fe0c52 pbrook
46 e5fe0c52 pbrook
#define FLAT_FLAG_RAM    0x0001 /* load program entirely into RAM */
47 e5fe0c52 pbrook
#define FLAT_FLAG_GOTPIC 0x0002 /* program is PIC with GOT */
48 e5fe0c52 pbrook
#define FLAT_FLAG_GZIP   0x0004 /* all but the header is compressed */
49 e5fe0c52 pbrook
#define FLAT_FLAG_GZDATA 0x0008 /* only data/relocs are compressed (for XIP) */
50 e5fe0c52 pbrook
#define FLAT_FLAG_KTRACE 0x0010 /* output useful kernel trace for debugging */
51 e5fe0c52 pbrook
52 e5fe0c52 pbrook
53 e5fe0c52 pbrook
/*
54 e5fe0c52 pbrook
 * While it would be nice to keep this header clean,  users of older
55 e5fe0c52 pbrook
 * tools still need this support in the kernel.  So this section is
56 e5fe0c52 pbrook
 * purely for compatibility with old tool chains.
57 e5fe0c52 pbrook
 *
58 e5fe0c52 pbrook
 * DO NOT make changes or enhancements to the old format please,  just work
59 e5fe0c52 pbrook
 *        with the format above,  except to fix bugs with old format support.
60 e5fe0c52 pbrook
 */
61 e5fe0c52 pbrook
62 e5fe0c52 pbrook
#define        OLD_FLAT_VERSION                        0x00000002L
63 e5fe0c52 pbrook
#define OLD_FLAT_RELOC_TYPE_TEXT        0
64 e5fe0c52 pbrook
#define OLD_FLAT_RELOC_TYPE_DATA        1
65 e5fe0c52 pbrook
#define OLD_FLAT_RELOC_TYPE_BSS                2
66 e5fe0c52 pbrook
67 e5fe0c52 pbrook
#           define OLD_FLAT_FLAG_RAM    0x1 /* load program entirely into RAM */