From patchwork Fri Aug 19 22:43:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Kiper X-Patchwork-Id: 9291295 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 07894600CB for ; Fri, 19 Aug 2016 22:46:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C297295CE for ; Fri, 19 Aug 2016 22:46:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 009E5295D6; Fri, 19 Aug 2016 22:46:40 +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 718B5295CE for ; Fri, 19 Aug 2016 22:46:40 +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 1basWq-0002cK-P2; Fri, 19 Aug 2016 22:44:44 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1basWq-0002bn-Am for xen-devel@lists.xenproject.org; Fri, 19 Aug 2016 22:44:44 +0000 Received: from [85.158.139.211] by server-11.bemta-5.messagelabs.com id 83/5A-12614-BDB87B75; Fri, 19 Aug 2016 22:44:43 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrNLMWRWlGSWpSXmKPExsUyZ7p8oO6t7u3 hBsunW1h83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBm9E1cyFfRIVmxbfZC9gfGCUBcjJ4eQwGQm iVXrPLsYuYDsv4wSa5cdZodwNjJKdK5sY4GomsgosXSpIIjNJqAjcfHLQ3YQW0RASeLeqslMI A3MAnOYJK727mICSQgLREg8WXSdGcRmEVCVmP28EWgQBwevgLvEjDkWIGEJAUWJ7mcT2EBsTg EPiT+bHjFB7HKXePznBxtEjbFE+9uLbBMY+RYwMqxi1ChOLSpLLdI1NNRLKspMzyjJTczM0TU 0MNXLTS0uTkxPzUlMKtZLzs/dxAgMFAYg2MG4st35EKMkB5OSKK+f2vZwIb6k/JTKjMTijPii 0pzU4kOMMhwcShK8DV1AOcGi1PTUirTMHGDIwqQlOHiURHi3gKR5iwsSc4sz0yFSpxgVpcR5o 0ESAiCJjNI8uDZYnFxilJUS5mUEOkSIpyC1KDezBFX+FaM4B6OSMO9ukCk8mXklcNNfAS1mAl rMy78FZHFJIkJKqoHRW0ribLwOf1Djxy+yHy9YlNTJ/PqxLc6i/kLFxx38vzinVyvvXbRzx5O PHhzBMeLF6Zd8pvrtrVFvuHRTjI1b4pRS1XdVnQCpKQsyxZLbhW9I5C3bK7pZ0iDqraZXmIPl pJ+udosO/TV8+5zDfXr9Hr60xseOSom/1/aeDtiYm71OcM8264VKLMUZiYZazEXFiQBrAYb3j gIAAA== X-Env-Sender: daniel.kiper@oracle.com X-Msg-Ref: server-4.tower-206.messagelabs.com!1471646681!55440298!1 X-Originating-IP: [156.151.31.81] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTU2LjE1MS4zMS44MSA9PiAyODgzMzk=\n X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 4917 invoked from network); 19 Aug 2016 22:44:42 -0000 Received: from userp1040.oracle.com (HELO userp1040.oracle.com) (156.151.31.81) by server-4.tower-206.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 19 Aug 2016 22:44:42 -0000 Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u7JMiY85000328 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 19 Aug 2016 22:44:34 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id u7JMiYbQ001467 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 19 Aug 2016 22:44:34 GMT Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id u7JMiXpI012553; Fri, 19 Aug 2016 22:44:33 GMT Received: from olila.local.net-space.pl (/10.175.190.131) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 19 Aug 2016 15:44:33 -0700 From: Daniel Kiper To: xen-devel@lists.xenproject.org Date: Sat, 20 Aug 2016 00:43:18 +0200 Message-Id: <1471646606-28519-9-git-send-email-daniel.kiper@oracle.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1471646606-28519-1-git-send-email-daniel.kiper@oracle.com> References: <1471646606-28519-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, gang.wei@intel.com, fu.wei@linaro.org Subject: [Xen-devel] [PATCH v5 08/16] 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; }