Browse Source

Replace image->entry with image->priv.

tags/v0.9.3
Michael Brown 18 years ago
parent
commit
797edf28b7
4 changed files with 16 additions and 8 deletions
  1. 4
    3
      src/arch/i386/image/multiboot.c
  2. 5
    1
      src/arch/i386/image/nbi.c
  3. 2
    2
      src/image/elf.c
  4. 5
    2
      src/include/gpxe/image.h

+ 4
- 3
src/arch/i386/image/multiboot.c View File

218
  * @ret rc		Return status code
218
  * @ret rc		Return status code
219
  */
219
  */
220
 static int multiboot_exec ( struct image *image ) {
220
 static int multiboot_exec ( struct image *image ) {
221
+	physaddr_t entry = image->priv.phys;
221
 
222
 
222
 	/* Populate multiboot information structure */
223
 	/* Populate multiboot information structure */
223
 	memset ( &mbinfo, 0, sizeof ( mbinfo ) );
224
 	memset ( &mbinfo, 0, sizeof ( mbinfo ) );
241
 	__asm__ __volatile__ ( PHYS_CODE ( "call *%%edi\n\t" )
242
 	__asm__ __volatile__ ( PHYS_CODE ( "call *%%edi\n\t" )
242
 			       : : "a" ( MULTIBOOT_BOOTLOADER_MAGIC ),
243
 			       : : "a" ( MULTIBOOT_BOOTLOADER_MAGIC ),
243
 			           "b" ( virt_to_phys ( &mbinfo ) ),
244
 			           "b" ( virt_to_phys ( &mbinfo ) ),
244
-			           "D" ( image->entry )
245
+			           "D" ( entry )
245
 			       : "ecx", "edx", "esi", "ebp", "memory" );
246
 			       : "ecx", "edx", "esi", "ebp", "memory" );
246
 
247
 
247
 	DBGC ( image, "MULTIBOOT %p returned\n", image );
248
 	DBGC ( image, "MULTIBOOT %p returned\n", image );
328
 	/* Copy image to segment */
329
 	/* Copy image to segment */
329
 	memcpy_user ( buffer, 0, image->data, offset, filesz );
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
 	return 0;
335
 	return 0;
335
 }
336
 }

+ 5
- 1
src/arch/i386/image/nbi.c View File

277
 					   nbi_load_segment ) ) != 0 )
277
 					   nbi_load_segment ) ) != 0 )
278
 		return rc;
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
 	return 0;
284
 	return 0;
281
 }
285
 }
282
 
286
 
370
 static int nbi_exec ( struct image *image ) {
374
 static int nbi_exec ( struct image *image ) {
371
 	struct imgheader imgheader;
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
 			 sizeof ( imgheader ) );
378
 			 sizeof ( imgheader ) );
375
 
379
 
376
 	if ( NBI_LINEAR_EXEC_ADDR ( imgheader.flags ) ) {
380
 	if ( NBI_LINEAR_EXEC_ADDR ( imgheader.flags ) ) {

+ 2
- 2
src/image/elf.c View File

136
 			return rc;
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
 	return 0;
142
 	return 0;
143
 }
143
 }

+ 5
- 2
src/include/gpxe/image.h View File

35
 
35
 
36
 	/** Image type, if known */
36
 	/** Image type, if known */
37
 	struct image_type *type;
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
 /** Image is loaded */
45
 /** Image is loaded */

Loading…
Cancel
Save