david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

Replace image->entry with image->priv.

This commit is contained in:
Michael Brown 2007-01-14 04:04:28 +00:00
parent 3bdbfe1f00
commit 797edf28b7
4 changed files with 16 additions and 8 deletions

View File

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

View File

@ -277,6 +277,10 @@ int nbi_load ( struct image *image ) {
nbi_load_segment ) ) != 0 ) nbi_load_segment ) ) != 0 )
return rc; return rc;
/* Record header address in image private data field */
image->priv.user = real_to_user ( imgheader.location.segment,
imgheader.location.offset );
return 0; return 0;
} }
@ -370,7 +374,7 @@ static int nbi_boot32 ( struct image *image, struct imgheader *imgheader ) {
static int nbi_exec ( struct image *image ) { static int nbi_exec ( struct image *image ) {
struct imgheader imgheader; struct imgheader imgheader;
copy_from_user ( &imgheader, phys_to_user ( image->entry ), 0, copy_from_user ( &imgheader, image->priv.user, 0,
sizeof ( imgheader ) ); sizeof ( imgheader ) );
if ( NBI_LINEAR_EXEC_ADDR ( imgheader.flags ) ) { if ( NBI_LINEAR_EXEC_ADDR ( imgheader.flags ) ) {

View File

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

View File

@ -35,8 +35,11 @@ struct image {
/** Image type, if known */ /** Image type, if known */
struct image_type *type; struct image_type *type;
/** Entry point */ /** Image type private data */
physaddr_t entry; union {
physaddr_t phys;
userptr_t user;
} priv;
}; };
/** Image is loaded */ /** Image is loaded */