Skip to content

Commit

Permalink
Replace image->entry with image->priv.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Brown committed Jan 14, 2007
1 parent 3bdbfe1 commit 797edf2
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
7 changes: 4 additions & 3 deletions src/arch/i386/image/multiboot.c
Expand Up @@ -218,6 +218,7 @@ static struct multiboot_module __data16_array ( mbmodules, [MAX_MODULES] );
* @ret rc Return status code
*/
static int multiboot_exec ( struct image *image ) {
physaddr_t entry = image->priv.phys;

/* Populate multiboot information structure */
memset ( &mbinfo, 0, sizeof ( mbinfo ) );
Expand All @@ -241,7 +242,7 @@ static int multiboot_exec ( struct image *image ) {
__asm__ __volatile__ ( PHYS_CODE ( "call *%%edi\n\t" )
: : "a" ( MULTIBOOT_BOOTLOADER_MAGIC ),
"b" ( virt_to_phys ( &mbinfo ) ),
"D" ( image->entry )
"D" ( entry )
: "ecx", "edx", "esi", "ebp", "memory" );

DBGC ( image, "MULTIBOOT %p returned\n", image );
Expand Down Expand Up @@ -328,8 +329,8 @@ static int multiboot_load_raw ( struct image *image,
/* Copy image to segment */
memcpy_user ( buffer, 0, image->data, offset, filesz );

/* Record execution entry point */
image->entry = hdr->mb.entry_addr;
/* Record execution entry point in image private data field */
image->priv.phys = hdr->mb.entry_addr;

return 0;
}
Expand Down
6 changes: 5 additions & 1 deletion src/arch/i386/image/nbi.c
Expand Up @@ -277,6 +277,10 @@ int nbi_load ( struct image *image ) {
nbi_load_segment ) ) != 0 )
return rc;

/* Record header address in image private data field */
image->priv.user = real_to_user ( imgheader.location.segment,
imgheader.location.offset );

return 0;
}

Expand Down Expand Up @@ -370,7 +374,7 @@ static int nbi_boot32 ( struct image *image, struct imgheader *imgheader ) {
static int nbi_exec ( struct image *image ) {
struct imgheader imgheader;

copy_from_user ( &imgheader, phys_to_user ( image->entry ), 0,
copy_from_user ( &imgheader, image->priv.user, 0,
sizeof ( imgheader ) );

if ( NBI_LINEAR_EXEC_ADDR ( imgheader.flags ) ) {
Expand Down
4 changes: 2 additions & 2 deletions src/image/elf.c
Expand Up @@ -136,8 +136,8 @@ int elf_load ( struct image *image ) {
return rc;
}

/* Fill in entry point address */
image->entry = ehdr.e_entry;
/* Record execution entry point in image private data field */
image->priv.phys = ehdr.e_entry;

return 0;
}
Expand Down
7 changes: 5 additions & 2 deletions src/include/gpxe/image.h
Expand Up @@ -35,8 +35,11 @@ struct image {

/** Image type, if known */
struct image_type *type;
/** Entry point */
physaddr_t entry;
/** Image type private data */
union {
physaddr_t phys;
userptr_t user;
} priv;
};

/** Image is loaded */
Expand Down

0 comments on commit 797edf2

Please sign in to comment.