Ver código fonte

Force probing of multiboot before ELF.

tags/v0.9.3
Michael Brown 17 anos atrás
pai
commit
6fdc6c81a6
3 arquivos alterados com 24 adições e 12 exclusões
  1. 2
    2
      src/arch/i386/image/multiboot.c
  2. 2
    2
      src/image/elf.c
  3. 20
    8
      src/include/gpxe/image.h

+ 2
- 2
src/arch/i386/image/multiboot.c Ver arquivo

@@ -33,7 +33,7 @@
33 33
 #include <gpxe/memmap.h>
34 34
 #include <gpxe/elf.h>
35 35
 
36
-struct image_type multiboot_image_type __image_type;
36
+struct image_type multiboot_image_type __image_type ( PROBE_MULTIBOOT );
37 37
 
38 38
 /** Multiboot flags that we support */
39 39
 #define MB_SUPPORTED_FLAGS ( MB_FLAG_PGALIGN | MB_FLAG_MEMMAP | \
@@ -320,7 +320,7 @@ int multiboot_load ( struct image *image ) {
320 320
 }
321 321
 
322 322
 /** Multiboot image type */
323
-struct image_type multiboot_image_type __image_type = {
323
+struct image_type multiboot_image_type __image_type ( PROBE_MULTIBOOT ) = {
324 324
 	.name = "Multiboot",
325 325
 	.load = multiboot_load,
326 326
 	.exec = multiboot_exec,

+ 2
- 2
src/image/elf.c Ver arquivo

@@ -30,7 +30,7 @@
30 30
 #include <gpxe/image.h>
31 31
 #include <gpxe/elf.h>
32 32
 
33
-struct image_type elf_image_type __image_type;
33
+struct image_type elf_image_type __image_type ( PROBE_NORMAL );
34 34
 
35 35
 typedef Elf32_Ehdr	Elf_Ehdr;
36 36
 typedef Elf32_Phdr	Elf_Phdr;
@@ -143,7 +143,7 @@ int elf_load ( struct image *image ) {
143 143
 }
144 144
 
145 145
 /** ELF image type */
146
-struct image_type elf_image_type __image_type = {
146
+struct image_type elf_image_type __image_type ( PROBE_NORMAL ) = {
147 147
 	.name = "ELF",
148 148
 	.load = elf_load,
149 149
 	.exec = elf_exec,

+ 20
- 8
src/include/gpxe/image.h Ver arquivo

@@ -79,18 +79,30 @@ struct image_type {
79 79
 	int ( * exec ) ( struct image *image );
80 80
 };
81 81
 
82
-/** An executable or loadable image type */
83
-#define __image_type __table ( struct image_type, image_types, 01 )
82
+/**
83
+ * Multiboot image probe priority
84
+ *
85
+ * Multiboot images are also valid executables in another format
86
+ * (e.g. ELF), so we must perform the multiboot probe first.
87
+ */
88
+#define PROBE_MULTIBOOT	01
84 89
 
85 90
 /**
86
- * An unverifiable executable or loadable image type
91
+ * Normal image probe priority
92
+ */
93
+#define PROBE_NORMAL 02
94
+
95
+/**
96
+ * PXE image probe priority
87 97
  *
88
- * This should be used to mark image types for which there are no
89
- * signature or other checks that can be used to verify the validity
90
- * of the image (such as PXE images).  These will then be tried last
91
- * in the list of image types.
98
+ * PXE images have no signature checks, so will claim all image files.
99
+ * They must therefore be tried last in the probe order list.
92 100
  */
93
-#define __default_image_type __table ( struct image_type, image_types, 02 )
101
+#define PROBE_PXE 03
102
+
103
+/** An executable or loadable image type */
104
+#define __image_type( probe_order ) \
105
+	 __table ( struct image_type, image_types, probe_order )
94 106
 
95 107
 extern struct list_head images;
96 108
 

Carregando…
Cancelar
Salvar