From patchwork Mon Sep 12 20:18: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: 9327991 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 840C96089F for ; Mon, 12 Sep 2016 20:23:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 74E1E28EAB for ; Mon, 12 Sep 2016 20:23:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 699CB28EAE; Mon, 12 Sep 2016 20:23:48 +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 12EAD28EAB for ; Mon, 12 Sep 2016 20:23:48 +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 1bjXjQ-00066f-3a; Mon, 12 Sep 2016 20:21:32 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bjXjP-00065q-6B for xen-devel@lists.xenproject.org; Mon, 12 Sep 2016 20:21:31 +0000 Received: from [85.158.137.68] by server-16.bemta-3.messagelabs.com id 3A/1C-29579-A4E07D75; Mon, 12 Sep 2016 20:21:30 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrDLMWRWlGSWpSXmKPExsUyZ7p8oK4n3/V wg09LjC2+b5nM5MDocfjDFZYAxijWzLyk/IoE1oy+jvVsBXckKvasUm5gXCLUxcjFISQwmUni 77F7TBDOF0aJwx8vMEI4Gxklrh66wA7hTGCUONM6gaWLkZODTUBH4uKXh+wgtoiAksS9VZPB2 pkF5jBJXO3dBeRwcAgLREhcPcsLUsMioCrx6v5mNhCbV8Bd4uP5J2C9EgKKEt3PJoDFOQU8JJ 53TWAGsYWAao6sPswEUWMs0f72ItsERr4FjAyrGDWKU4vKUot0DY30kooy0zNKchMzc3QNDYz 1clOLixPTU3MSk4r1kvNzNzECQ4UBCHYwvup2PsQoycGkJMqbJHgtXIgvKT+lMiOxOCO+qDQn tfgQowwHh5IELx/v9XAhwaLU9NSKtMwcYNDCpCU4eJREeE/yAKV5iwsSc4sz0yFSpxgVpcR5R UD6BEASGaV5cG2wSLnEKCslzMsIdIgQT0FqUW5mCar8K0ZxDkYlYd5jION5MvNK4Ka/AlrMBL T46dbLIItLEhFSUg2Mag7fNncs6fwQOG1tfvUNAz3huDf7T/lutNp5Mf8k02QWs2v3a9ZwpNm b6Vw021N67xyHu6Vih9PSYI5ns9+u3nwz3d/7ecCPiCnXLDP5jxYuy9rxYD83u+T7nb0zchUf bvwyVdzhzVbmBTcLdI8WJZS9PrnurNEWbkFfkynafkunhUp0ize+UmIpzkg01GIuKk4EAK+4A MGPAgAA X-Env-Sender: daniel.kiper@oracle.com X-Msg-Ref: server-10.tower-31.messagelabs.com!1473711688!59610898!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 9325 invoked from network); 12 Sep 2016 20:21:29 -0000 Received: from userp1040.oracle.com (HELO userp1040.oracle.com) (156.151.31.81) by server-10.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 12 Sep 2016 20:21:29 -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 u8CKLKh8027018 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Sep 2016 20:21:20 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id u8CKLJxp030297 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 12 Sep 2016 20:21:19 GMT Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by userv0121.oracle.com (8.13.8/8.13.8) with ESMTP id u8CKL88K021153; Mon, 12 Sep 2016 20:21:13 GMT Received: from olila.local.net-space.pl (/10.175.172.57) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 12 Sep 2016 13:21:07 -0700 From: Daniel Kiper To: xen-devel@lists.xenproject.org Date: Mon, 12 Sep 2016 22:18:18 +0200 Message-Id: <1473711511-11931-4-git-send-email-daniel.kiper@oracle.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1473711511-11931-1-git-send-email-daniel.kiper@oracle.com> References: <1473711511-11931-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 v6 03/15] 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 9053e2c..ea8cb37 100644 --- a/xen/arch/x86/boot/reloc.c +++ b/xen/arch/x86/boot/reloc.c @@ -65,45 +65,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 = _p(copy_mem(mbi_old, sizeof(*mbi))); + mbi_out = _p(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 = _p(mbi->mods_addr); + mods = _p(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; }