From patchwork Fri Aug 19 22:43:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Kiper X-Patchwork-Id: 9291283 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 14CEB6086A for ; Fri, 19 Aug 2016 22:46:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1A484295CE for ; Fri, 19 Aug 2016 22:46:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0F123295D6; Fri, 19 Aug 2016 22:46:17 +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 92953295D2 for ; Fri, 19 Aug 2016 22:46:16 +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 1basWN-0002N2-20; Fri, 19 Aug 2016 22:44:15 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1basWL-0002Ly-Ro for xen-devel@lists.xenproject.org; Fri, 19 Aug 2016 22:44:13 +0000 Received: from [85.158.137.68] by server-3.bemta-3.messagelabs.com id CB/FB-23620-DBB87B75; Fri, 19 Aug 2016 22:44:13 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrLLMWRWlGSWpSXmKPExsXSO6nOVXdP9/Z wg62P5Cy+b5nM5MDocfjDFZYAxijWzLyk/IoE1oyPlx4yFawTqXj04yprA+M7vi5GLg4hgTYm iaPv/jNDON8YJfZP288K4WxklHj7YzkThDORUeLarRNADicHm4COxMUvD9lBbBEBJYl7qyaDF TELzGGSuNq7C6xIWCBQ4vqbr4wgNouAqsSqK2+BdnBw8Aq4S3xeLQ4SlhBQlOh+NoENxOYU8J D4s+kRWKsQUMnjPz/YIGoMJU4/3MY4gZFvASPDKkaN4tSistQiXUNTvaSizPSMktzEzBxdQwN jvdzU4uLE9NScxKRiveT83E2MwGBhAIIdjGu2ex5ilORgUhLl9VPbHi7El5SfUpmRWJwRX1Sa k1p8iFGGg0NJgpcBGHxCgkWp6akVaZk5wLCFSUtw8CiJ8P7oAkrzFhck5hZnpkOkTjEqSonzn gNJCIAkMkrz4NpgsXKJUVZKmJcR6BAhnoLUotzMElT5V4ziHIxKwrwNIFN4MvNK4Ka/AlrMBL SYl38LyOKSRISUVANj4Ia5T01Pzd7AtjXnEMdP+83CjJNF7l9Rmn6rwW1mydx/gRYSZdKWNmf an0x8fo45iPOmjIRw9rH0E2+qUy+4Oy/szX5sxrraIIgtvOekVntJpqbWxcc1Va8v/HdUXOV8 K/O02e6b6wTrIsolpTgs3gdprJ0rtaJob7t3S9PKHSsff05YOc9ViaU4I9FQi7moOBEAxINiT JACAAA= X-Env-Sender: daniel.kiper@oracle.com X-Msg-Ref: server-5.tower-31.messagelabs.com!1471646650!53332320!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.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 10287 invoked from network); 19 Aug 2016 22:44:12 -0000 Received: from aserp1040.oracle.com (HELO aserp1040.oracle.com) (141.146.126.69) by server-5.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 19 Aug 2016 22:44:12 -0000 Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u7JMi2fx012980 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 19 Aug 2016 22:44:03 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0021.oracle.com (8.13.8/8.13.8) with ESMTP id u7JMi2cg009479 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 19 Aug 2016 22:44:02 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 u7JMi1OX012277; Fri, 19 Aug 2016 22:44:01 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:01 -0700 From: Daniel Kiper To: xen-devel@lists.xenproject.org Date: Sat, 20 Aug 2016 00:43:15 +0200 Message-Id: <1471646606-28519-6-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: userv0021.oracle.com [156.151.31.71] 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 05/16] 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 subsequent patch adding multiboot2 protocol support have to pass 3 arguments instead of 2. Hence, move reloc() call to stdcall calling convention. One may argue that we should use standard cdecl calling convention. However, stdcall is better here than cdecl because we do not need to remove "manually" arguments from stack in xen/arch/x86/boot/head.S assembly file. Suggested-by: Jan Beulich Signed-off-by: Daniel Kiper Acked-by: Jan Beulich --- v5 - suggestions/fixes: - improve commit message (suggested 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;