This commit introduces the start and size fields to struct boot_module and
assigns their value during boot_info construction.
The EFI entry point is a special case, as the EFI file loading boot service may
load a file beyond the 4G barrier. As a result, to make the address fit in the
32bit integer used by the MB1 module_t structure, the frame number is stored in
mod_start and size in mod_end. Until the EFI entry point is enlightened to work
with boot_info and boot_module, multiboot_fill_boot_info will handle the
alternate values in mod_start and mod_end when EFI is detected.
Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
Changes since v6:
- put the efi conversion for mod_start and mod_end back along with check
- dropped unnecessary cast
- updated the population of start and size fields to take into account efi
Changes since v5:
- switched EFI population of mod_start/mod_end to addresses
---
xen/arch/x86/include/asm/bootinfo.h | 3 +++
xen/arch/x86/setup.c | 15 +++++++++++++++
2 files changed, 18 insertions(+)
diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm/bootinfo.h
index e8fba66eedc5..dbd22db3d063 100644
--- a/xen/arch/x86/include/asm/bootinfo.h
+++ b/xen/arch/x86/include/asm/bootinfo.h
@@ -46,6 +46,9 @@ struct boot_module {
* relocated: indicates module has been relocated in memory.
*/
bool relocated:1;
+
+ paddr_t start;
+ size_t size;
};
/*
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 17f74384b5c1..2e87aa314389 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -315,10 +315,25 @@ static struct boot_info *__init multiboot_fill_boot_info(unsigned long mbi_p)
* reserved for Xen.
*/
for ( i = 0; i < MAX_NR_BOOTMODS && i < bi->nr_modules; i++ )
+ {
bi->mods[i].mod = &mods[i];
+ if ( !efi_enabled(EFI_LOADER) )
+ {
+ bi->mods[i].start = mods[i].mod_start;
+ bi->mods[i].size = mods[i].mod_end - mods[i].mod_start;
+ }
+ else
+ {
+ bi->mods[i].start = pfn_to_paddr(mods[i].mod_start);
+ bi->mods[i].size = mods[i].mod_end;
+ }
+ }
+
/* Variable 'i' should be one entry past the last module. */
bi->mods[i].mod = &mods[bi->nr_modules];
+ bi->mods[i].start = mods[i].mod_start;
+ bi->mods[i].size = mods[i].mod_end - mods[i].mod_start;
bi->mods[i].type = BOOTMOD_XEN;
return bi;
--
2.30.2