mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
x86/boot: introduce boot module flags
The existing startup code employs various ad-hoc state tracking about certain boot module types by each area of the code. A boot module flags bitfield is added to enable tracking these different states. The first state to be transition by this commit is module relocation. Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
This commit is contained in:
1 parent
74af2d9827
commit
4e7863e82d
2 files changed
+9
-4
No files matched your search
@@ -29,6 +29,12 @@ struct boot_module {
|
||||
module_t *mod;
|
||||
|
||||
enum bootmod_type type;
|
||||
|
||||
/*
|
||||
* Module State Flags:
|
||||
* relocated: indicates module has been relocated in memory.
|
||||
*/
|
||||
bool relocated:1;
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@@ -1392,7 +1392,6 @@ void asmlinkage __init noreturn __start_xen(void)
|
||||
panic("Bootloader didn't honor module alignment request\n");
|
||||
bi->mods[i].mod->mod_end -= bi->mods[i].mod->mod_start;
|
||||
bi->mods[i].mod->mod_start >>= PAGE_SHIFT;
|
||||
bi->mods[i].mod->reserved = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1508,7 +1507,7 @@ void asmlinkage __init noreturn __start_xen(void)
|
||||
unsigned long headroom = j ? 0 : modules_headroom;
|
||||
unsigned long size = PAGE_ALIGN(headroom + bm->mod->mod_end);
|
||||
|
||||
if ( bm->mod->reserved )
|
||||
if ( bm->relocated )
|
||||
continue;
|
||||
|
||||
/* Don't overlap with other modules (or Xen itself). */
|
||||
@@ -1526,7 +1525,7 @@ void asmlinkage __init noreturn __start_xen(void)
|
||||
pfn_to_paddr(bm->mod->mod_start), bm->mod->mod_end);
|
||||
bm->mod->mod_start = (end - size) >> PAGE_SHIFT;
|
||||
bm->mod->mod_end += headroom;
|
||||
bm->mod->reserved = 1;
|
||||
bm->relocated = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1552,7 +1551,7 @@ void asmlinkage __init noreturn __start_xen(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
if ( modules_headroom && !bi->mods[0].mod->reserved )
|
||||
if ( modules_headroom && !bi->mods[0].relocated )
|
||||
panic("Not enough memory to relocate the dom0 kernel image\n");
|
||||
for ( i = 0; i < bi->nr_modules; ++i )
|
||||
{
|
||||
|
||||