@@ -1504,7 +1504,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
struct boot_module *bm = &boot_info->mods[j];
unsigned long size;
- size = PAGE_ALIGN(bm->headroom + bm->early_mod->mod_end);
+ size = PAGE_ALIGN(bm->headroom + bm->size);
if ( boot_info->mods[j].flags & BOOTMOD_FLAG_X86_RELOCATED )
continue;
@@ -1518,13 +1518,12 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
if ( s < end &&
(bm->headroom ||
- ((end - size) >> PAGE_SHIFT) > bm->early_mod->mod_start) )
+ paddr_to_pfn(end - size) > paddr_to_pfn(bm->start)) )
{
- move_memory(end - size + bm->headroom,
- (uint64_t)bm->early_mod->mod_start << PAGE_SHIFT,
- bm->early_mod->mod_end);
- bm->early_mod->mod_start = (end - size) >> PAGE_SHIFT;
- bm->early_mod->mod_end += bm->headroom;
+ move_memory(end - size + bm->headroom, bm->start, bm->size);
+ bm->start = (end - size);
+ bm->early_mod->mod_start = paddr_to_pfn(bm->start);
+ bm->size = bm->early_mod->mod_end += bm->headroom;
bm->flags |= BOOTMOD_FLAG_X86_RELOCATED;
}
}
@@ -1556,11 +1555,10 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
panic("Not enough memory to relocate the dom0 kernel image\n");
for ( i = 0; i < boot_info->nr_mods; ++i )
{
- uint64_t s = (uint64_t)boot_info->mods[i].early_mod->mod_start
- << PAGE_SHIFT;
+ uint64_t s = (uint64_t)boot_info->mods[i].start;
reserve_e820_ram(&boot_e820, s,
- s + PAGE_ALIGN(boot_info->mods[i].early_mod->mod_end));
+ s + PAGE_ALIGN(boot_info->mods[i].size));
}
if ( !xen_phys_start )
@@ -1638,9 +1636,8 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
map_e = boot_e820.map[j].addr + boot_e820.map[j].size;
for ( j = 0; j < boot_info->nr_mods; ++j )
{
- uint64_t end = pfn_to_paddr(
- boot_info->mods[j].early_mod->mod_start) +
- boot_info->mods[j].early_mod->mod_end;
+ uint64_t end = boot_info->mods[j].start +
+ boot_info->mods[j].size;
if ( map_e < end )
map_e = end;
@@ -1714,13 +1711,13 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
for ( i = 0; i < boot_info->nr_mods; ++i )
{
- set_pdx_range(boot_info->mods[i].early_mod->mod_start,
- boot_info->mods[i].early_mod->mod_start +
+ set_pdx_range(paddr_to_pfn(boot_info->mods[i].start),
+ paddr_to_pfn(boot_info->mods[i].start) +
PFN_UP(boot_info->mods[i].early_mod->mod_end));
map_pages_to_xen(
- (unsigned long)mfn_to_virt(boot_info->mods[i].early_mod->mod_start),
- _mfn(boot_info->mods[i].early_mod->mod_start),
- PFN_UP(boot_info->mods[i].early_mod->mod_end), PAGE_HYPERVISOR);
+ (unsigned long)maddr_to_virt(boot_info->mods[i].start),
+ maddr_to_mfn(boot_info->mods[i].start),
+ PFN_UP(boot_info->mods[i].size), PAGE_HYPERVISOR);
}
#ifdef CONFIG_KEXEC
Use struct boot_module fields, start and size, when calculating the relocation address and size. It also ensures that early_mod references are kept in sync. Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com> --- xen/arch/x86/setup.c | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-)