aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Brown <mcb30@etherboot.org>2007-01-14 04:04:28 +0000
committerMichael Brown <mcb30@etherboot.org>2007-01-14 04:04:28 +0000
commit797edf28b7e2f0f6fe374bbe230e68b2ab05cbdc (patch)
treef267383b9a9a21c8092afe9f2aadb5f00e7f33b5 /src
parent3bdbfe1f003b398ae6775906747d8b5c955960ee (diff)
downloadipxe-797edf28b7e2f0f6fe374bbe230e68b2ab05cbdc.tar.gz
Replace image->entry with image->priv.
Diffstat (limited to 'src')
-rw-r--r--src/arch/i386/image/multiboot.c7
-rw-r--r--src/arch/i386/image/nbi.c6
-rw-r--r--src/image/elf.c4
-rw-r--r--src/include/gpxe/image.h7
4 files changed, 16 insertions, 8 deletions
diff --git a/src/arch/i386/image/multiboot.c b/src/arch/i386/image/multiboot.c
index 7e89fef75..a198ef741 100644
--- a/src/arch/i386/image/multiboot.c
+++ b/src/arch/i386/image/multiboot.c
@@ -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 ) );
@@ -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 );
@@ -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;
}
diff --git a/src/arch/i386/image/nbi.c b/src/arch/i386/image/nbi.c
index 974b1b054..ad483b4fb 100644
--- a/src/arch/i386/image/nbi.c
+++ b/src/arch/i386/image/nbi.c
@@ -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;
}
@@ -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 ) ) {
diff --git a/src/image/elf.c b/src/image/elf.c
index 167ef2bf7..75c976eaf 100644
--- a/src/image/elf.c
+++ b/src/image/elf.c
@@ -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;
}
diff --git a/src/include/gpxe/image.h b/src/include/gpxe/image.h
index de10c369e..3bfe834e4 100644
--- a/src/include/gpxe/image.h
+++ b/src/include/gpxe/image.h
@@ -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 */