Kaynağa Gözat

Replace image->entry with image->priv.

tags/v0.9.3
Michael Brown 18 yıl önce
ebeveyn
işleme
797edf28b7

+ 4
- 3
src/arch/i386/image/multiboot.c Dosyayı Görüntüle

@@ -218,6 +218,7 @@ static struct multiboot_module __data16_array ( mbmodules, [MAX_MODULES] );
218 218
  * @ret rc		Return status code
219 219
  */
220 220
 static int multiboot_exec ( struct image *image ) {
221
+	physaddr_t entry = image->priv.phys;
221 222
 
222 223
 	/* Populate multiboot information structure */
223 224
 	memset ( &mbinfo, 0, sizeof ( mbinfo ) );
@@ -241,7 +242,7 @@ static int multiboot_exec ( struct image *image ) {
241 242
 	__asm__ __volatile__ ( PHYS_CODE ( "call *%%edi\n\t" )
242 243
 			       : : "a" ( MULTIBOOT_BOOTLOADER_MAGIC ),
243 244
 			           "b" ( virt_to_phys ( &mbinfo ) ),
244
-			           "D" ( image->entry )
245
+			           "D" ( entry )
245 246
 			       : "ecx", "edx", "esi", "ebp", "memory" );
246 247
 
247 248
 	DBGC ( image, "MULTIBOOT %p returned\n", image );
@@ -328,8 +329,8 @@ static int multiboot_load_raw ( struct image *image,
328 329
 	/* Copy image to segment */
329 330
 	memcpy_user ( buffer, 0, image->data, offset, filesz );
330 331
 
331
-	/* Record execution entry point */
332
-	image->entry = hdr->mb.entry_addr;
332
+	/* Record execution entry point in image private data field */
333
+	image->priv.phys = hdr->mb.entry_addr;
333 334
 
334 335
 	return 0;
335 336
 }

+ 5
- 1
src/arch/i386/image/nbi.c Dosyayı Görüntüle

@@ -277,6 +277,10 @@ int nbi_load ( struct image *image ) {
277 277
 					   nbi_load_segment ) ) != 0 )
278 278
 		return rc;
279 279
 
280
+	/* Record header address in image private data field */
281
+	image->priv.user = real_to_user ( imgheader.location.segment,
282
+					  imgheader.location.offset );
283
+
280 284
 	return 0;
281 285
 }
282 286
 
@@ -370,7 +374,7 @@ static int nbi_boot32 ( struct image *image, struct imgheader *imgheader ) {
370 374
 static int nbi_exec ( struct image *image ) {
371 375
 	struct imgheader imgheader;
372 376
 
373
-	copy_from_user ( &imgheader, phys_to_user ( image->entry ), 0,
377
+	copy_from_user ( &imgheader, image->priv.user, 0,
374 378
 			 sizeof ( imgheader ) );
375 379
 
376 380
 	if ( NBI_LINEAR_EXEC_ADDR ( imgheader.flags ) ) {

+ 2
- 2
src/image/elf.c Dosyayı Görüntüle

@@ -136,8 +136,8 @@ int elf_load ( struct image *image ) {
136 136
 			return rc;
137 137
 	}
138 138
 
139
-	/* Fill in entry point address */
140
-	image->entry = ehdr.e_entry;
139
+	/* Record execution entry point in image private data field */
140
+	image->priv.phys = ehdr.e_entry;
141 141
 
142 142
 	return 0;
143 143
 }

+ 5
- 2
src/include/gpxe/image.h Dosyayı Görüntüle

@@ -35,8 +35,11 @@ struct image {
35 35
 
36 36
 	/** Image type, if known */
37 37
 	struct image_type *type;
38
-	/** Entry point */
39
-	physaddr_t entry;
38
+	/** Image type private data */
39
+	union {
40
+		physaddr_t phys;
41
+		userptr_t user;
42
+	} priv;
40 43
 };
41 44
 
42 45
 /** Image is loaded */

Loading…
İptal
Kaydet