|
@@ -0,0 +1,60 @@
|
|
1
|
+#ifndef _GPXE_IMAGE_H
|
|
2
|
+#define _GPXE_IMAGE_H
|
|
3
|
+
|
|
4
|
+/**
|
|
5
|
+ * @file
|
|
6
|
+ *
|
|
7
|
+ * Executable/loadable image formats
|
|
8
|
+ *
|
|
9
|
+ */
|
|
10
|
+
|
|
11
|
+#include <gpxe/tables.h>
|
|
12
|
+
|
|
13
|
+/** An executable or loadable image */
|
|
14
|
+struct image {
|
|
15
|
+ /** Raw file image */
|
|
16
|
+ userptr_t image;
|
|
17
|
+ /** Length of raw file image */
|
|
18
|
+ size_t len;
|
|
19
|
+
|
|
20
|
+ /** Execute method
|
|
21
|
+ *
|
|
22
|
+ * Filled in by the image loader. If NULL, then the image
|
|
23
|
+ * cannot be executed.
|
|
24
|
+ */
|
|
25
|
+ int ( * execute ) ( struct image *image );
|
|
26
|
+ /** Entry point */
|
|
27
|
+ physaddr_t entry;
|
|
28
|
+};
|
|
29
|
+
|
|
30
|
+/** An executable or loadable image type */
|
|
31
|
+struct image_type {
|
|
32
|
+ /** Name of this image type */
|
|
33
|
+ char *name;
|
|
34
|
+ /** Load image into memory
|
|
35
|
+ *
|
|
36
|
+ * @v image Executable/loadable image
|
|
37
|
+ * @ret rc Return status code
|
|
38
|
+ *
|
|
39
|
+ * Load the image into memory. The file image may be
|
|
40
|
+ * discarded after this call; the method must preserve any
|
|
41
|
+ * information it may require later (e.g. the execution
|
|
42
|
+ * address) within the @c image structure.
|
|
43
|
+ */
|
|
44
|
+ int ( * load ) ( struct image *image );
|
|
45
|
+};
|
|
46
|
+
|
|
47
|
+/** An executable or loadable image type */
|
|
48
|
+#define __image_type __table ( struct image_type, image_types, 01 )
|
|
49
|
+
|
|
50
|
+/**
|
|
51
|
+ * An unverifiable executable or loadable image type
|
|
52
|
+ *
|
|
53
|
+ * This should be used to mark image types for which there are no
|
|
54
|
+ * signature or other checks that can be used to verify the validity
|
|
55
|
+ * of the image (such as PXE images). These will then be tried last
|
|
56
|
+ * in the list of image types.
|
|
57
|
+ */
|
|
58
|
+#define __default_image_type __table ( struct image_type, image_types, 02 )
|
|
59
|
+
|
|
60
|
+#endif /* _GPXE_IMAGE_H */
|