From patchwork Thu Jul 28 10:50:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony PERARD X-Patchwork-Id: 9251099 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 B8DAD6075F for ; Thu, 28 Jul 2016 10:54:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA4D526785 for ; Thu, 28 Jul 2016 10:54:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9EA5926B4A; Thu, 28 Jul 2016 10:54:37 +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 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 0570026785 for ; Thu, 28 Jul 2016 10:54:37 +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 1bSitc-0007CS-PP; Thu, 28 Jul 2016 10:50: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 1bSitb-0007A6-NT for xen-devel@lists.xen.org; Thu, 28 Jul 2016 10:50:31 +0000 Received: from [85.158.137.68] by server-7.bemta-3.messagelabs.com id 1A/FF-03271-673E9975; Thu, 28 Jul 2016 10:50:30 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprEIsWRWlGSWpSXmKPExsXitHRDpG7Z45n hBj2fxS2WfFzM4sDocXT3b6YAxijWzLyk/IoE1ozmZ8vYCk4IVjyd/4mlgXE1XxcjJ4eEgL/E 9HOvGUFsNgEDiRXTr4LZIgKyEqu75rB3MXJxMAscYZS4dfMnWEJYwEWi48EtJhCbRUBV4v3lm +wgNq+AnURL2ylWiKFyEg3n7zOD2JwC9hIrD98HqxECqjm0cSEzhK0mcWPhMhaIXkGJkzOfgN nMAhISB1+8YIaYwy1x+/RU5gmMfLOQlM1CUraAkWkVo0ZxalFZapGuoYVeUlFmekZJbmJmjq6 hgbFebmpxcWJ6ak5iUrFecn7uJkZgWNUzMDDuYPx92vMQoyQHk5Iob1jozHAhvqT8lMqMxOKM +KLSnNTiQ4wyHBxKEryZj4BygkWp6akVaZk5wACHSUtw8CiJ8G4DSfMWFyTmFmemQ6ROMSpKi fOagCQEQBIZpXlwbbCousQoKyXMy8jAwCDEU5BalJtZgir/ilGcg1FJmHcmyBSezLwSuOmvgB YzAS0ujp0BsrgkESEl1cBYZ8n6c8aaE4/dT+TfnCerOGHTxVMNnkVMTx+L7J70QlTmSOh/cx5 RlassBfdKy6dr3vKtfrDs6LkVp1aoGu2duM85lb3qwlnF+E7T4tg3vbfsmRM4v8yX0spaeih6 7QbpLlX14Btzzyac+8wlcHTuuVdcZpr+xi/mzvp2ZrHIxScvD3vmrni2Q4mlOCPRUIu5qDgRA EK6jo2lAgAA X-Env-Sender: prvs=0100a76d6=anthony.perard@citrix.com X-Msg-Ref: server-4.tower-31.messagelabs.com!1469703028!2637216!1 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 8.77; banners=-,-,- X-VirusChecked: Checked Received: (qmail 3410 invoked from network); 28 Jul 2016 10:50:30 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-4.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 28 Jul 2016 10:50:30 -0000 X-IronPort-AV: E=Sophos;i="5.28,433,1464652800"; d="scan'208";a="368929250" From: Anthony PERARD To: Date: Thu, 28 Jul 2016 11:50:05 +0100 Message-ID: <20160728105013.22310-8-anthony.perard@citrix.com> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20160728105013.22310-1-anthony.perard@citrix.com> References: <20160728105013.22310-1-anthony.perard@citrix.com> MIME-Version: 1.0 X-DLP: MIA2 Cc: Anthony PERARD , Andrew Cooper , Ian Jackson , Wei Liu , Jan Beulich Subject: [Xen-devel] [PATCH v7 07/15] hvmloader: Grab the hvm_start_info pointer 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: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Anthony PERARD Reviewed-by: Konrad Rzeszutek Wilk Acked-by: Jan Beulich Reviewed-by: Andrew Cooper --- Changes in V6: - include xen/arch-x86/hvm/start_info.h Change in V4: - remove struct hvm_info_start redefinition, as it's moved to public/xen.h in a previous patch. Change in V3: - remove cmdline parser - load hvm_start_info pointer earlier, before calling main(). - Add struct hvm_start_info definition to hvmloader. --- tools/firmware/hvmloader/hvmloader.c | 6 ++++++ tools/firmware/hvmloader/util.h | 3 +++ 2 files changed, 9 insertions(+) diff --git a/tools/firmware/hvmloader/hvmloader.c b/tools/firmware/hvmloader/hvmloader.c index 716d03c..77c70e0 100644 --- a/tools/firmware/hvmloader/hvmloader.c +++ b/tools/firmware/hvmloader/hvmloader.c @@ -28,6 +28,9 @@ #include "vnuma.h" #include #include +#include + +const struct hvm_start_info *hvm_start_info; asm ( " .text \n" @@ -46,6 +49,8 @@ asm ( " ljmp $"STR(SEL_CODE32)",$1f \n" "1: movl $stack_top,%esp \n" " movl %esp,%ebp \n" + /* store HVM start info ptr */ + " mov %ebx, hvm_start_info \n" " call main \n" /* Relocate real-mode trampoline to 0x0. */ " mov $trampoline_start,%esi \n" @@ -258,6 +263,7 @@ int main(void) memset((void *)HYPERCALL_PHYSICAL_ADDRESS, 0xc3 /* RET */, PAGE_SIZE); printf("HVM Loader\n"); + BUG_ON(hvm_start_info->magic != XEN_HVM_START_MAGIC_VALUE); init_hypercalls(); diff --git a/tools/firmware/hvmloader/util.h b/tools/firmware/hvmloader/util.h index 3126817..9808016 100644 --- a/tools/firmware/hvmloader/util.h +++ b/tools/firmware/hvmloader/util.h @@ -158,6 +158,9 @@ static inline void cpu_relax(void) struct hvm_info_table *get_hvm_info_table(void) __attribute__ ((const)); #define hvm_info (get_hvm_info_table()) +/* HVM start info */ +extern const struct hvm_start_info *hvm_start_info; + /* String and memory functions */ int strcmp(const char *cs, const char *ct); int strncmp(const char *s1, const char *s2, uint32_t n);