[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 07/23] x86/boot/reloc: Rename some variables and rearrange cod
From: |
Daniel Kiper |
Subject: |
[PATCH v2 07/23] x86/boot/reloc: Rename some variables and rearrange code a bit |
Date: |
Mon, 20 Jul 2015 16:29:02 +0200 |
Rename mbi and mbi_old variables and rearrange code a bit to make
it more readable. Additionally, this way multiboot (v1) protocol
implementation and future multiboot2 protocol implementation will
use the same variable naming convention.
Signed-off-by: Daniel Kiper <address@hidden>
---
v2 - suggestions/fixes:
- extract this change from main mutliboot2
protocol implementation
(suggested by Jan Beulich).
---
xen/arch/x86/boot/reloc.c | 39 +++++++++++++++++++++------------------
1 file changed, 21 insertions(+), 18 deletions(-)
diff --git a/xen/arch/x86/boot/reloc.c b/xen/arch/x86/boot/reloc.c
index 09fd540..feb1d72 100644
--- a/xen/arch/x86/boot/reloc.c
+++ b/xen/arch/x86/boot/reloc.c
@@ -86,41 +86,44 @@ static u32 copy_string(u32 src)
return copy_mem(src, p - src + 1);
}
-multiboot_info_t *reloc(u32 mbi_old)
+multiboot_info_t *reloc(u32 mbi_in)
{
- multiboot_info_t *mbi = (multiboot_info_t *)copy_mem(mbi_old,
sizeof(*mbi));
int i;
+ multiboot_info_t *mbi_out;
- if ( mbi->flags & MBI_CMDLINE )
- mbi->cmdline = copy_string(mbi->cmdline);
+ mbi_out = (multiboot_info_t *)copy_mem(mbi_in, sizeof(*mbi_out));
- if ( mbi->flags & MBI_MODULES )
+ if ( mbi_out->flags & MBI_CMDLINE )
+ mbi_out->cmdline = copy_string(mbi_out->cmdline);
+
+ if ( mbi_out->flags & MBI_MODULES )
{
module_t *mods;
- mbi->mods_addr = copy_mem(mbi->mods_addr, mbi->mods_count *
sizeof(module_t));
+ mbi_out->mods_addr = copy_mem(mbi_out->mods_addr,
+ mbi_out->mods_count * sizeof(module_t));
- mods = (module_t *)mbi->mods_addr;
+ mods = (module_t *)mbi_out->mods_addr;
- for ( i = 0; i < mbi->mods_count; i++ )
+ for ( i = 0; i < mbi_out->mods_count; i++ )
{
if ( mods[i].string )
mods[i].string = copy_string(mods[i].string);
}
}
- if ( mbi->flags & MBI_MEMMAP )
- mbi->mmap_addr = copy_mem(mbi->mmap_addr, mbi->mmap_length);
+ if ( mbi_out->flags & MBI_MEMMAP )
+ mbi_out->mmap_addr = copy_mem(mbi_out->mmap_addr,
mbi_out->mmap_length);
- if ( mbi->flags & MBI_LOADERNAME )
- mbi->boot_loader_name = copy_string(mbi->boot_loader_name);
+ if ( mbi_out->flags & MBI_LOADERNAME )
+ mbi_out->boot_loader_name = copy_string(mbi_out->boot_loader_name);
/* Mask features we don't understand or don't relocate. */
- mbi->flags &= (MBI_MEMLIMITS |
- MBI_CMDLINE |
- MBI_MODULES |
- MBI_MEMMAP |
- MBI_LOADERNAME);
+ mbi_out->flags &= (MBI_MEMLIMITS |
+ MBI_CMDLINE |
+ MBI_MODULES |
+ MBI_MEMMAP |
+ MBI_LOADERNAME);
- return mbi;
+ return mbi_out;
}
--
1.7.10.4
- [PATCH v2 00/23] x86: multiboot2 protocol support, Daniel Kiper, 2015/07/20
- [PATCH v2 01/23] x86/boot: remove unneeded instruction, Daniel Kiper, 2015/07/20
- [PATCH v2 04/23] x86/boot: call reloc() using cdecl calling convention, Daniel Kiper, 2015/07/20
- [PATCH v2 03/23] x86: zero BSS using stosl instead of stosb, Daniel Kiper, 2015/07/20
- [PATCH v2 07/23] x86/boot/reloc: Rename some variables and rearrange code a bit,
Daniel Kiper <=
- [PATCH v2 06/23] x86/boot: use %ecx instead of %eax, Daniel Kiper, 2015/07/20
- [PATCH v2 05/23] x86/boot/reloc: create generic alloc and copy functions, Daniel Kiper, 2015/07/20
- [PATCH v2 08/23] x86: add multiboot2 protocol support, Daniel Kiper, 2015/07/20
- [PATCH v2 11/23] efi: split out efi_init(), Daniel Kiper, 2015/07/20
- [PATCH v2 12/23] efi: split out efi_console_set_mode(), Daniel Kiper, 2015/07/20
- [PATCH v2 02/23] x86/boot: copy only text section from *.lnk file to *.bin file, Daniel Kiper, 2015/07/20
- [PATCH v2 13/23] efi: split out efi_get_gop(), Daniel Kiper, 2015/07/20
- [PATCH v2 16/23] efi: split out efi_variables(), Daniel Kiper, 2015/07/20
- [PATCH v2 19/23] x86/efi: create new early memory allocator, Daniel Kiper, 2015/07/20
- [PATCH v2 18/23] efi: split out efi_exit_boot(), Daniel Kiper, 2015/07/20