mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
x86/boot: Simplify the expression for extra allocation space
The expression for one parameter of find_memory() is already complicated and about to become moreso. Break it out into a new variable, and express it in an easier-to-follow way. No functional change. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
This commit is contained in:
1 parent
ab7ce0c8ed
commit
ce703c84df
1 file changed
+11
-7
@@ -654,6 +654,7 @@ static int __init pvh_load_kernel(
|
||||
const char *cmdline = image->cmdline_pa ? __va(image->cmdline_pa) : NULL;
|
||||
struct elf_binary elf;
|
||||
struct elf_dom_parms parms;
|
||||
size_t extra_space;
|
||||
paddr_t last_addr;
|
||||
struct hvm_start_info start_info = { 0 };
|
||||
struct hvm_modlist_entry mod = { 0 };
|
||||
@@ -711,13 +712,16 @@ static int __init pvh_load_kernel(
|
||||
* split into smaller allocations, done as a single region in order to
|
||||
* simplify it.
|
||||
*/
|
||||
last_addr = find_memory(d, &elf, sizeof(start_info) +
|
||||
(initrd ? ROUNDUP(initrd_len, PAGE_SIZE) +
|
||||
sizeof(mod)
|
||||
: 0) +
|
||||
(cmdline ? ROUNDUP(strlen(cmdline) + 1,
|
||||
elf_64bit(&elf) ? 8 : 4)
|
||||
: 0));
|
||||
extra_space = sizeof(start_info);
|
||||
|
||||
if ( initrd )
|
||||
extra_space += sizeof(mod) + ROUNDUP(initrd_len, PAGE_SIZE);
|
||||
|
||||
if ( cmdline )
|
||||
extra_space += ROUNDUP(strlen(cmdline) + 1,
|
||||
elf_64bit(&elf) ? 8 : 4);
|
||||
|
||||
last_addr = find_memory(d, &elf, extra_space);
|
||||
if ( last_addr == INVALID_PADDR )
|
||||
{
|
||||
printk("Unable to find a memory region to load initrd and metadata\n");
|
||||
|
||||