xref: /qemu/linux-user/flat.h (revision a6819c1b)
1e5fe0c52Spbrook /*
2e5fe0c52Spbrook  * Copyright (C) 2002-2003  David McCullough <davidm@snapgear.com>
3e5fe0c52Spbrook  * Copyright (C) 1998       Kenneth Albanowski <kjahds@kjahds.com>
4e5fe0c52Spbrook  *                          The Silver Hammer Group, Ltd.
5e5fe0c52Spbrook  *
6e5fe0c52Spbrook  * This file provides the definitions and structures needed to
7e5fe0c52Spbrook  * support uClinux flat-format executables.
8e5fe0c52Spbrook  */
9e5fe0c52Spbrook 
10f91005e1SMarkus Armbruster #ifndef LINUX_USER_FLAT_H
11f91005e1SMarkus Armbruster #define LINUX_USER_FLAT_H
12f91005e1SMarkus Armbruster 
13e5fe0c52Spbrook #define	FLAT_VERSION			0x00000004L
14e5fe0c52Spbrook 
15a6819c1bSPeter Maydell /* QEMU doesn't support bflt shared libraries */
16e5fe0c52Spbrook #define	MAX_SHARED_LIBS			(1)
17e5fe0c52Spbrook 
18e5fe0c52Spbrook /*
19e5fe0c52Spbrook  * To make everything easier to port and manage cross platform
20e5fe0c52Spbrook  * development,  all fields are in network byte order.
21e5fe0c52Spbrook  */
22e5fe0c52Spbrook 
23e5fe0c52Spbrook struct flat_hdr {
24e5fe0c52Spbrook 	char magic[4];
25992f48a0Sblueswir1 	abi_ulong rev;          /* version (as above) */
26992f48a0Sblueswir1 	abi_ulong entry;        /* Offset of first executable instruction
27e5fe0c52Spbrook                                    with text segment from beginning of file */
28992f48a0Sblueswir1 	abi_ulong data_start;   /* Offset of data segment from beginning of
29e5fe0c52Spbrook                                    file */
30992f48a0Sblueswir1 	abi_ulong data_end;     /* Offset of end of data segment
31e5fe0c52Spbrook                                    from beginning of file */
32992f48a0Sblueswir1 	abi_ulong bss_end;      /* Offset of end of bss segment from beginning
33e5fe0c52Spbrook                                    of file */
34e5fe0c52Spbrook 
35e5fe0c52Spbrook 	/* (It is assumed that data_end through bss_end forms the bss segment.) */
36e5fe0c52Spbrook 
37992f48a0Sblueswir1 	abi_ulong stack_size;   /* Size of stack, in bytes */
38992f48a0Sblueswir1 	abi_ulong reloc_start;  /* Offset of relocation records from
39e5fe0c52Spbrook                                    beginning of file */
40992f48a0Sblueswir1 	abi_ulong reloc_count;  /* Number of relocation records */
41992f48a0Sblueswir1 	abi_ulong flags;
42992f48a0Sblueswir1 	abi_ulong build_date;   /* When the program/library was built */
436f9ff551Szhaolichang 	abi_ulong filler[5];    /* Reserved, set to zero */
44e5fe0c52Spbrook };
45e5fe0c52Spbrook 
46e5fe0c52Spbrook #define FLAT_FLAG_RAM    0x0001 /* load program entirely into RAM */
47e5fe0c52Spbrook #define FLAT_FLAG_GOTPIC 0x0002 /* program is PIC with GOT */
48e5fe0c52Spbrook #define FLAT_FLAG_GZIP   0x0004 /* all but the header is compressed */
49e5fe0c52Spbrook #define FLAT_FLAG_GZDATA 0x0008 /* only data/relocs are compressed (for XIP) */
50e5fe0c52Spbrook #define FLAT_FLAG_KTRACE 0x0010 /* output useful kernel trace for debugging */
51e5fe0c52Spbrook 
52e5fe0c52Spbrook 
53e5fe0c52Spbrook /*
54e5fe0c52Spbrook  * While it would be nice to keep this header clean,  users of older
55e5fe0c52Spbrook  * tools still need this support in the kernel.  So this section is
56e5fe0c52Spbrook  * purely for compatibility with old tool chains.
57e5fe0c52Spbrook  *
58e5fe0c52Spbrook  * DO NOT make changes or enhancements to the old format please,  just work
59e5fe0c52Spbrook  *        with the format above,  except to fix bugs with old format support.
60e5fe0c52Spbrook  */
61e5fe0c52Spbrook 
62e5fe0c52Spbrook #define	OLD_FLAT_VERSION			0x00000002L
63e5fe0c52Spbrook #define OLD_FLAT_RELOC_TYPE_TEXT	0
64e5fe0c52Spbrook #define OLD_FLAT_RELOC_TYPE_DATA	1
65e5fe0c52Spbrook #define OLD_FLAT_RELOC_TYPE_BSS		2
66e5fe0c52Spbrook 
67e5fe0c52Spbrook #   	define OLD_FLAT_FLAG_RAM    0x1 /* load program entirely into RAM */
68f91005e1SMarkus Armbruster 
69f91005e1SMarkus Armbruster #endif
70