Просмотр исходного кода

We may be required to page-align modules, so let's make sure we catch

it if we don't.
tags/v0.9.3
Michael Brown 17 лет назад
Родитель
Сommit
e4c6418ac0
1 измененных файлов: 7 добавлений и 1 удалений
  1. 7
    1
      src/arch/i386/image/multiboot.c

+ 7
- 1
src/arch/i386/image/multiboot.c Просмотреть файл

@@ -24,6 +24,7 @@
24 24
  */
25 25
 
26 26
 #include <errno.h>
27
+#include <assert.h>
27 28
 #include <alloca.h>
28 29
 #include <multiboot.h>
29 30
 #include <gpxe/uaccess.h>
@@ -106,10 +107,12 @@ multiboot_build_module_list ( struct image *image,
106 107
 	unsigned int count = 0;
107 108
 
108 109
 	for_each_image ( module_image ) {
109
-		/* Do not include kernel image as a module */
110
+
111
+		/* Do not include kernel image itself as a module */
110 112
 		if ( module_image == image )
111 113
 			continue;
112 114
 		module = &modules[count++];
115
+
113 116
 		/* Populate module data structure, if applicable */
114 117
 		if ( ! modules )
115 118
 			continue;
@@ -118,6 +121,9 @@ multiboot_build_module_list ( struct image *image,
118 121
 						 module_image->len );
119 122
 		if ( image->cmdline )
120 123
 			module->string = virt_to_phys ( image->cmdline );
124
+
125
+		/* We promise to page-align modules, so at least check */
126
+		assert ( ( module->mod_start & 0xfff ) == 0 );
121 127
 	}
122 128
 
123 129
 	return count;

Загрузка…
Отмена
Сохранить