mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-08 02:17:07 +08:00
A little more ELF loader logic
git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5253 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
+5
-4
@@ -86,16 +86,17 @@
|
||||
/* Ehe ELF identifier */
|
||||
|
||||
#define EI_MAG0 0 /* File identification */
|
||||
#define EI_MAG1 1 /* File identification */
|
||||
#define EI_MAG2 2 /* File identification */
|
||||
#define EI_MAG3 3 /* File identification */
|
||||
#define EI_MAG1 1 /* " " " " */
|
||||
#define EI_MAG2 2 /* " " " " */
|
||||
#define EI_MAG3 3 /* " " " " */
|
||||
#define EI_CLASS 4 /* File class */
|
||||
#define EI_DATA 5 /* Data encoding */
|
||||
#define EI_VERSION 6 /* File version */
|
||||
#define EI_PAD 7 /* Start of padding bytes */
|
||||
#define EI_NIDENT 16 /* Size of eident[] */
|
||||
|
||||
#define EI_MAGIC { 0x7f, 'E', 'L', 'F' }
|
||||
#define EI_MAGIC_SIZE 4
|
||||
#define EI_MAGIC {0x7f, 'E', 'L', 'F'}
|
||||
|
||||
/* Values for EI_CLASS */
|
||||
|
||||
|
||||
@@ -60,38 +60,12 @@
|
||||
|
||||
struct elf_loadinfo_s
|
||||
{
|
||||
/* Instruction Space (ISpace): This region contains the ELF file header
|
||||
* plus everything from the text section. Ideally, will have only one mmap'ed
|
||||
* text section instance in the system for each module.
|
||||
*/
|
||||
|
||||
uint32_t ispace; /* Address where hdr/text is loaded */
|
||||
uint32_t entryoffs; /* Offset from ispace to entry point */
|
||||
uint32_t isize; /* Size of ispace. */
|
||||
|
||||
/* Data Space (DSpace): This region contains all information that in referenced
|
||||
* as data (other than the stack which is separately allocated). There will be
|
||||
* a unique instance of DSpace (and stack) for each instance of a process.
|
||||
*/
|
||||
|
||||
FAR struct dspace_s *dspace; /* Allocated D-Space (data/bss/etc) */
|
||||
uint32_t datasize; /* Size of data segment in dspace */
|
||||
uint32_t bsssize; /* Size of bss segment in dspace */
|
||||
uint32_t stacksize; /* Size of stack (not allocated) */
|
||||
uint32_t dsize; /* Size of dspace (may be large than parts) */
|
||||
|
||||
/* This is temporary memory where relocation records will be loaded. */
|
||||
|
||||
uint32_t relocstart; /* Start of array of struct flat_reloc */
|
||||
uint16_t reloccount; /* Number of elements in reloc array */
|
||||
|
||||
/* File descriptors */
|
||||
|
||||
int filfd; /* Descriptor for the file being loaded */
|
||||
|
||||
/* This is a copy of the ELF header */
|
||||
|
||||
Elf32_Ehdr header;
|
||||
uintptr_t alloc; /* Allocated memory with the ELF file is loaded */
|
||||
size_t allocsize; /* Size of the memory allocation */
|
||||
off_t filelen; /* Length of the entire ELF file */
|
||||
int filfd; /* Descriptor for the file being loaded */
|
||||
Elf32_Ehdr ehdr; /* Buffered ELF file header */
|
||||
FAR Elf32_Shdr *shdr; /* Buffered ELF section headers */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
Reference in New Issue
Block a user