From patchwork Fri Aug 5 23:04:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Kiper X-Patchwork-Id: 9265771 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 A49C96089F for ; Fri, 5 Aug 2016 23:08:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9322928462 for ; Fri, 5 Aug 2016 23:08:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 87B742848E; Fri, 5 Aug 2016 23:08:08 +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 289F12846A for ; Fri, 5 Aug 2016 23:08:08 +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 1bVoBL-00033N-As; Fri, 05 Aug 2016 23:05:35 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bVoBJ-00031T-9h for xen-devel@lists.xenproject.org; Fri, 05 Aug 2016 23:05:33 +0000 Received: from [85.158.139.211] by server-12.bemta-5.messagelabs.com id 33/59-01026-CBB15A75; Fri, 05 Aug 2016 23:05:32 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrHLMWRWlGSWpSXmKPExsXSO6nOVXeP9NJ wg7Z/whbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8ajxr8sBbeEKnq7JrE3MO7j7WLk4hASaGeS OLbrJSOE85lRoqGjD8rZwCixo/cKlDORUWLel5/MXYycHGwCOhIXvzxkB7FFBJQk7q2azARSx CxwlEni/+THrCAJYYFAidnzfrCB2CwCqhLvli0Da+YVcJPofHwdrFlCQFGi+9kEsBpOAXeJeR ufg9lCQDUfu+ezQtQYS7S/vcg2gZFvASPDKkaN4tSistQiXSMLvaSizPSMktzEzBxdQwNTvdz U4uLE9NScxKRiveT83E2MwHCpZ2Bg3MHYt8rvEKMkB5OSKO/5y0vChfiS8lMqMxKLM+KLSnNS iw8xynBwKEnwTpVaGi4kWJSanlqRlpkDDFyYtAQHj5II7xWQNG9xQWJucWY6ROoUo6KUOO85k IQASCKjNA+uDRYtlxhlpYR5GRkYGIR4ClKLcjNLUOVfMYpzMCoJ814CmcKTmVcCN/0V0GImoM UfrZaALC5JREhJNTBOObfw5hvWs4/Xij+9w523wm7SZ6XU+H0WJ7d+mW7oYvex5WeT92bhc7m bjr3Qi1vvqTMzqYhl0tmYl4+2c7psv/bjR5LJc5FTGmWc8+v28K7wPLhMjl1w5olohv8GTnWl VtHblx9RZf5tw5n8vM/n24qmJQcPiDyzci7YPPHffLX64N5nZVsslViKMxINtZiLihMBIDIsK JECAAA= X-Env-Sender: daniel.kiper@oracle.com X-Msg-Ref: server-13.tower-206.messagelabs.com!1470438330!37570758!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 31544 invoked from network); 5 Aug 2016 23:05:32 -0000 Received: from aserp1040.oracle.com (HELO aserp1040.oracle.com) (141.146.126.69) by server-13.tower-206.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 5 Aug 2016 23:05:32 -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 u75N5OSE005320 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 5 Aug 2016 23:05:24 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0022.oracle.com (8.13.8/8.13.8) with ESMTP id u75N5OsW019486 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 5 Aug 2016 23:05:24 GMT Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id u75N5NgN024846; Fri, 5 Aug 2016 23:05:23 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:22 -0700 From: Daniel Kiper To: xen-devel@lists.xenproject.org Date: Sat, 6 Aug 2016 01:04:28 +0200 Message-Id: <1470438282-4226-6-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 05/19] x86/boot: call reloc() using stdcall calling convention 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 Current reloc() call method makes confusion and does not scale well for more arguments. And patch adding multiboot2 protocol support have to pass 3 arguments instead of 2. Hence, move reloc() call to stdcall calling convention. This way, in comparison to cdecl calling convention, we do not need to remove arguments from stack in xen/arch/x86/boot/head.S assembly file too. Suggested-by: Jan Beulich Signed-off-by: Daniel Kiper Acked-by: Jan Beulich --- v4 - suggestions/fixes: - move to stdcall calling convention (suggested by Jan Beulich). v3 - suggestions/fixes: - simplify assembly in xen/arch/x86/boot/reloc.c file (suggested by Jan Beulich), - reorder arguments for reloc() call from xen/arch/x86/boot/head.S (suggested by Jan Beulich), - improve commit message (suggested by Jan Beulich). --- xen/arch/x86/boot/head.S | 3 ++- xen/arch/x86/boot/reloc.c | 11 ++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S index e34351c..7e5ae12 100644 --- a/xen/arch/x86/boot/head.S +++ b/xen/arch/x86/boot/head.S @@ -119,7 +119,8 @@ __start: /* Save the Multiboot info struct (after relocation) for later use. */ mov $sym_phys(cpu0_stack)+1024,%esp - push %ebx + push %eax /* Boot trampoline address. */ + push %ebx /* Multiboot information address. */ call reloc mov %eax,sym_phys(multiboot_ptr) diff --git a/xen/arch/x86/boot/reloc.c b/xen/arch/x86/boot/reloc.c index 9ae42e2..28c6cea 100644 --- a/xen/arch/x86/boot/reloc.c +++ b/xen/arch/x86/boot/reloc.c @@ -10,15 +10,16 @@ * Keir Fraser */ -/* entered with %eax = BOOT_TRAMPOLINE */ +/* + * This entry point is entered from xen/arch/x86/boot/head.S with: + * - 0x4(%esp) = MULTIBOOT_INFORMATION_ADDRESS, + * - 0x8(%esp) = BOOT_TRAMPOLINE_ADDRESS. + */ asm ( " .text \n" " .globl _start \n" "_start: \n" - " push %eax \n" - " push 0x8(%esp) \n" - " call reloc \n" - " ret $0x4 \n" + " jmp reloc \n" ); typedef unsigned int u32;