Bläddra i källkod

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 år sedan
förälder
incheckning
230f16538f
2 ändrade filer med 30 tillägg och 8 borttagningar
  1. 4
    8
      src/image/elf.c
  2. 26
    0
      src/include/gpxe/elf.h

+ 4
- 8
src/image/elf.c Visa fil

@@ -27,19 +27,12 @@
27 27
 #include <elf.h>
28 28
 #include <gpxe/uaccess.h>
29 29
 #include <gpxe/segment.h>
30
+#include <gpxe/elf.h>
30 31
 
31 32
 typedef Elf32_Ehdr	Elf_Ehdr;
32 33
 typedef Elf32_Phdr	Elf_Phdr;
33 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 37
  * Load ELF segment into memory
45 38
  *
@@ -126,5 +119,8 @@ int elf_load ( struct elf *elf ) {
126 119
 			return rc;
127 120
 	}
128 121
 
122
+	/* Fill in entry point address */
123
+	elf->entry = ehdr.e_entry;
124
+
129 125
 	return 0;
130 126
 }

+ 26
- 0
src/include/gpxe/elf.h Visa fil

@@ -0,0 +1,26 @@
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 */

Laddar…
Avbryt
Spara