From patchwork Fri Aug 5 23:04:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Kiper X-Patchwork-Id: 9265775 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 516E260839 for ; Fri, 5 Aug 2016 23:08:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 39BEF2848E for ; Fri, 5 Aug 2016 23:08:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2E999284A0; Fri, 5 Aug 2016 23:08:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CDECA2846A for ; Fri, 5 Aug 2016 23:08:14 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bVoBX-0003EG-4J; Fri, 05 Aug 2016 23:05:47 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bVoBV-0003CM-Bb for xen-devel@lists.xenproject.org; Fri, 05 Aug 2016 23:05:45 +0000 Received: from [85.158.139.211] by server-14.bemta-5.messagelabs.com id 4E/D3-10347-8CB15A75; Fri, 05 Aug 2016 23:05:44 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrLLMWRWlGSWpSXmKPExsXSO6nOVfeE9NJ wg6OLBC2+b5nM5MDocfjDFZYAxijWzLyk/IoE1oyG1f8ZCx5JVKz/9JOxgXGVUBcjF4eQQDuT xMHf7cwQzldGiZ1dS5i6GDmBnA2MElMuSkEkJjJKbD9+iQUkwSagI3Hxy0N2EFtEQEni3qrJT CBFzAJHmST+T37MCpIQFoiQWDDlK1gDi4CqxKzby8DivAJuEjunXQJrlhBQlOh+NoENxOYUcJ eYt/E5G8RmN4mP3fNZIWqMJdrfXmSbwMi3gJFhFaNGcWpRWWqRrpGhXlJRZnpGSW5iZo6uoYG pXm5qcXFiempOYlKxXnJ+7iZGYLDUMzAw7mC8O9nvEKMkB5OSKO/5y0vChfiS8lMqMxKLM+KL SnNSiw8xynBwKEnwTpVaGi4kWJSanlqRlpkDDFuYtAQHj5II7xWQNG9xQWJucWY6ROoUo6KUO O85kIQASCKjNA+uDRYrlxhlpYR5GRkYGIR4ClKLcjNLUOVfMYpzMCoJ814CmcKTmVcCN/0V0G ImoMUfrZaALC5JREhJNTBOzzggfJdV86Pq2YjttRG+tkqXlF/tVUndz7NqZuYj8/vZfCynw9c 3CTXYtU/NYeh4EciurXAqR7Z9llXKy61bHlvaqE14k2gy/5CNr7PqZO7zmVP2h86vdLd7vPyN odA0hqzFQrIbuSJt7zhO/8F869IVRibxkpiQrPRdIWKCu441mS+4Wq/EUpyRaKjFXFScCACMo 83LkAIAAA== X-Env-Sender: daniel.kiper@oracle.com X-Msg-Ref: server-12.tower-206.messagelabs.com!1470438342!16841053!1 X-Originating-IP: [141.146.126.69] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTQxLjE0Ni4xMjYuNjkgPT4gMjc3MjE4\n X-StarScan-Received: X-StarScan-Version: 8.77; banners=-,-,- X-VirusChecked: Checked Received: (qmail 44302 invoked from network); 5 Aug 2016 23:05:43 -0000 Received: from aserp1040.oracle.com (HELO aserp1040.oracle.com) (141.146.126.69) by server-12.tower-206.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 5 Aug 2016 23:05:43 -0000 Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u75N5Xb9005387 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 5 Aug 2016 23:05:34 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0022.oracle.com (8.13.8/8.13.8) with ESMTP id u75N5Xul019642 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 5 Aug 2016 23:05:33 GMT Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by aserv0121.oracle.com (8.13.8/8.13.8) with ESMTP id u75N5WYb003493; Fri, 5 Aug 2016 23:05:33 GMT Received: from olila.local.net-space.pl (/10.175.255.156) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 05 Aug 2016 16:05:32 -0700 From: Daniel Kiper To: xen-devel@lists.xenproject.org Date: Sat, 6 Aug 2016 01:04:31 +0200 Message-Id: <1470438282-4226-9-git-send-email-daniel.kiper@oracle.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1470438282-4226-1-git-send-email-daniel.kiper@oracle.com> References: <1470438282-4226-1-git-send-email-daniel.kiper@oracle.com> X-Source-IP: aserv0022.oracle.com [141.146.126.234] Cc: jgross@suse.com, sstabellini@kernel.org, andrew.cooper3@citrix.com, cardoe@cardoe.com, pgnet.dev@gmail.com, ning.sun@intel.com, david.vrabel@citrix.com, jbeulich@suse.com, qiaowei.ren@intel.com, richard.l.maliszewski@intel.com, gang.wei@intel.com, fu.wei@linaro.org Subject: [Xen-devel] [PATCH v4 08/19] x86/boot/reloc: Rename some variables and rearrange code a bit X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Replace mbi with mbi_out and mbi_old with mbi_in 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 Acked-by: Jan Beulich --- v4 - suggestions/fixes: - move to stdcall calling convention. v3 - suggestions/fixes: - improve commit message (suggested by Konrad Rzeszutek Wilk). 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, 20 insertions(+), 19 deletions(-) diff --git a/xen/arch/x86/boot/reloc.c b/xen/arch/x86/boot/reloc.c index 21b1f32..dc6a435 100644 --- a/xen/arch/x86/boot/reloc.c +++ b/xen/arch/x86/boot/reloc.c @@ -63,45 +63,46 @@ static u32 copy_string(u32 src) return copy_mem(src, p - src + 1); } -multiboot_info_t __stdcall *reloc(u32 mbi_old, u32 trampoline) +multiboot_info_t __stdcall *reloc(u32 mbi_in, u32 trampoline) { - multiboot_info_t *mbi; int i; + multiboot_info_t *mbi_out; alloc = trampoline; - mbi = (multiboot_info_t *)copy_mem(mbi_old, sizeof(*mbi)); + mbi_out = (multiboot_info_t *)copy_mem(mbi_in, sizeof(*mbi_out)); - if ( mbi->flags & MBI_CMDLINE ) - mbi->cmdline = copy_string(mbi->cmdline); + if ( mbi_out->flags & MBI_CMDLINE ) + mbi_out->cmdline = copy_string(mbi_out->cmdline); - if ( mbi->flags & MBI_MODULES ) + 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; }