瀏覽代碼

Force probing of multiboot before ELF.

tags/v0.9.3
Michael Brown 17 年之前
父節點
當前提交
6fdc6c81a6
共有 3 個檔案被更改,包括 24 行新增12 行删除
  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 查看文件

33
 #include <gpxe/memmap.h>
33
 #include <gpxe/memmap.h>
34
 #include <gpxe/elf.h>
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
 /** Multiboot flags that we support */
38
 /** Multiboot flags that we support */
39
 #define MB_SUPPORTED_FLAGS ( MB_FLAG_PGALIGN | MB_FLAG_MEMMAP | \
39
 #define MB_SUPPORTED_FLAGS ( MB_FLAG_PGALIGN | MB_FLAG_MEMMAP | \
320
 }
320
 }
321
 
321
 
322
 /** Multiboot image type */
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
 	.name = "Multiboot",
324
 	.name = "Multiboot",
325
 	.load = multiboot_load,
325
 	.load = multiboot_load,
326
 	.exec = multiboot_exec,
326
 	.exec = multiboot_exec,

+ 2
- 2
src/image/elf.c 查看文件

30
 #include <gpxe/image.h>
30
 #include <gpxe/image.h>
31
 #include <gpxe/elf.h>
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
 typedef Elf32_Ehdr	Elf_Ehdr;
35
 typedef Elf32_Ehdr	Elf_Ehdr;
36
 typedef Elf32_Phdr	Elf_Phdr;
36
 typedef Elf32_Phdr	Elf_Phdr;
143
 }
143
 }
144
 
144
 
145
 /** ELF image type */
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
 	.name = "ELF",
147
 	.name = "ELF",
148
 	.load = elf_load,
148
 	.load = elf_load,
149
 	.exec = elf_exec,
149
 	.exec = elf_exec,

+ 20
- 8
src/include/gpxe/image.h 查看文件

79
 	int ( * exec ) ( struct image *image );
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
 extern struct list_head images;
107
 extern struct list_head images;
96
 
108
 

Loading…
取消
儲存