Browse Source

Create include/gpxe/elf.h for the ELF bits that aren't part of the ELF

standard and so don't belong in include/elf.h
tags/v0.9.3
Michael Brown 18 years ago
parent
commit
230f16538f
2 changed files with 30 additions and 8 deletions
  1. 4
    8
      src/image/elf.c
  2. 26
    0
      src/include/gpxe/elf.h

+ 4
- 8
src/image/elf.c View File

27
 #include <elf.h>
27
 #include <elf.h>
28
 #include <gpxe/uaccess.h>
28
 #include <gpxe/uaccess.h>
29
 #include <gpxe/segment.h>
29
 #include <gpxe/segment.h>
30
+#include <gpxe/elf.h>
30
 
31
 
31
 typedef Elf32_Ehdr	Elf_Ehdr;
32
 typedef Elf32_Ehdr	Elf_Ehdr;
32
 typedef Elf32_Phdr	Elf_Phdr;
33
 typedef Elf32_Phdr	Elf_Phdr;
33
 typedef Elf32_Off	Elf_Off;
34
 typedef Elf32_Off	Elf_Off;
34
 
35
 
35
-/** An ELF file */
36
-struct elf {
37
-	/** ELF file image */
38
-	userptr_t image;
39
-	/** Length of ELF file image */
40
-	size_t len;
41
-};
42
-
43
 /**
36
 /**
44
  * Load ELF segment into memory
37
  * Load ELF segment into memory
45
  *
38
  *
126
 			return rc;
119
 			return rc;
127
 	}
120
 	}
128
 
121
 
122
+	/* Fill in entry point address */
123
+	elf->entry = ehdr.e_entry;
124
+
129
 	return 0;
125
 	return 0;
130
 }
126
 }

+ 26
- 0
src/include/gpxe/elf.h View File

1
+#ifndef _GPXE_ELF_H
2
+#define _GPXE_ELF_H
3
+
4
+/**
5
+ * @file
6
+ *
7
+ * ELF image format
8
+ *
9
+ */
10
+
11
+#include <elf.h>
12
+
13
+/** An ELF file */
14
+struct elf {
15
+	/** ELF file image */
16
+	userptr_t image;
17
+	/** Length of ELF file image */
18
+	size_t len;
19
+
20
+	/** Entry point */
21
+	physaddr_t entry;
22
+};
23
+
24
+extern int elf_load ( struct elf *elf );
25
+
26
+#endif /* _GPXE_ELF_H */

Loading…
Cancel
Save