From patchwork Fri Apr 15 12:33:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Kiper X-Patchwork-Id: 8850691 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 71DD49FBEA for ; Fri, 15 Apr 2016 12:36:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 969DA20373 for ; Fri, 15 Apr 2016 12:36:01 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id 66CC320377 for ; Fri, 15 Apr 2016 12:36:00 +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 1ar2wg-00055w-En; Fri, 15 Apr 2016 12:33:58 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ar2wf-00053f-Ak for xen-devel@lists.xenproject.org; Fri, 15 Apr 2016 12:33:57 +0000 Received: from [85.158.137.68] by server-8.bemta-3.messagelabs.com id 7D/14-04050-5BFD0175; Fri, 15 Apr 2016 12:33:57 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrNLMWRWlGSWpSXmKPExsUyZ7p8oO6W+wL hBis6lS2+b5nM5MDocfjDFZYAxijWzLyk/IoE1oyzay6wFSwWq1jccJqtgbGTv4uRi0NIoINJ 4v/mf6xdjJxAzhdGiasbYyESGxglFv3aygLhTGSUOLTlIjNIFZuAjsTFLw/ZQWwRASWJe6smM 4EUMQucZ5KY1nmZBSQhLOAvcefsaSYQm0VAVeLPxFlgNq+Au8T51m9ggyQEFCW6n01gA7E5BT wkVnc2AfVyAG1zl/g3VQSixFii/e1FtgmMfAsYGVYxqhenFpWlFuka6SUVZaZnlOQmZuboGho Y6+WmFhcnpqfmJCYV6yXn525iBAZKPQMD4w7GU83OhxglOZiURHnn7hUIF+JLyk+pzEgszogv Ks1JLT7EKMPBoSTBa3APKCdYlJqeWpGWmQMMWZi0BAePkgivIUiat7ggMbc4Mx0idYpRUUqcl x0kIQCSyCjNg2uDxcklRlkpYV5GBgYGIZ6C1KLczBJU+VeM4hyMSsK8/+8CTeHJzCuBm/4KaD ET0OKyd7wgi0sSEVJSDYw5Dvfdjzxn7JKNz5nyJ5DzcUJB4za7nD+Tlp+ZskSmY0v77heSjaW WGkZMEtePesuseJqs5a7xnd/A/tpq6R9rRJ+fn7G4WHxdilj0zxm90g2TF4q/4KvblvPiZcof zgmz65KOyuQWMzqUn2P2WXB2sZDAcWvfhDuadtwpa81W/evP+ndIyV6JpTgj0VCLuag4EQAnc wGHjgIAAA== X-Env-Sender: daniel.kiper@oracle.com X-Msg-Ref: server-8.tower-31.messagelabs.com!1460723634!35149846!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.28; banners=-,-,- X-VirusChecked: Checked Received: (qmail 60652 invoked from network); 15 Apr 2016 12:33:56 -0000 Received: from userp1040.oracle.com (HELO userp1040.oracle.com) (156.151.31.81) by server-8.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 15 Apr 2016 12:33:56 -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 u3FCXlXB022707 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 15 Apr 2016 12:33:48 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0022.oracle.com (8.13.8/8.13.8) with ESMTP id u3FCXkvS015838 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 15 Apr 2016 12:33:47 GMT Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by userv0121.oracle.com (8.13.8/8.13.8) with ESMTP id u3FCXjTr022319; Fri, 15 Apr 2016 12:33:45 GMT Received: from olila.local.net-space.pl (/10.175.160.106) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 15 Apr 2016 05:33:45 -0700 From: Daniel Kiper To: xen-devel@lists.xenproject.org Date: Fri, 15 Apr 2016 14:33:03 +0200 Message-Id: <1460723596-13261-4-git-send-email-daniel.kiper@oracle.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1460723596-13261-1-git-send-email-daniel.kiper@oracle.com> References: <1460723596-13261-1-git-send-email-daniel.kiper@oracle.com> X-Source-IP: aserv0022.oracle.com [141.146.126.234] Cc: jgross@suse.com, andrew.cooper3@citrix.com, stefano.stabellini@eu.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 v3 03/16] x86/boot: call reloc() using cdecl 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP reloc() is not called according to cdecl calling convention. This 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 cdecl calling convention. I add push %ebp/mov %esp,%ebp/leave instructions here. Though they are not strictly needed in this patch. However, then assembly code in patch adding multiboot2 protocol support is easier to read. Suggested-by: Jan Beulich Signed-off-by: Daniel Kiper --- 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 | 4 +++- xen/arch/x86/boot/reloc.c | 18 ++++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S index 32a54a0..28ac721 100644 --- a/xen/arch/x86/boot/head.S +++ b/xen/arch/x86/boot/head.S @@ -119,8 +119,10 @@ __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 + add $8,%esp /* Remove reloc() args from stack. */ mov %eax,sym_phys(multiboot_ptr) /* Initialize BSS (no nasty surprises!). */ diff --git a/xen/arch/x86/boot/reloc.c b/xen/arch/x86/boot/reloc.c index 63045c0..006f41d 100644 --- a/xen/arch/x86/boot/reloc.c +++ b/xen/arch/x86/boot/reloc.c @@ -10,15 +10,25 @@ * 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 %ebp \n" + " mov %esp,%ebp \n" " call 1f \n" - "1: pop %ebx \n" - " mov %eax,alloc-1b(%ebx) \n" - " jmp reloc \n" + "1: pop %ecx \n" + " mov 0xc(%ebp),%eax \n" + " mov %eax,alloc-1b(%ecx) \n" + " push 0x8(%ebp) \n" + " call reloc \n" + " leave \n" + " ret \n" ); /*