From patchwork Wed Jun 22 17:15:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony PERARD X-Patchwork-Id: 9193385 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 2C056601C0 for ; Wed, 22 Jun 2016 17:18:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1890F2840A for ; Wed, 22 Jun 2016 17:18:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0D98828417; Wed, 22 Jun 2016 17:18:59 +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 DCC802840A for ; Wed, 22 Jun 2016 17:18:57 +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 1bFlle-0004pU-04; Wed, 22 Jun 2016 17:16:46 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bFllc-0004nl-PF for xen-devel@lists.xen.org; Wed, 22 Jun 2016 17:16:44 +0000 Received: from [193.109.254.147] by server-14.bemta-14.messagelabs.com id B8/2E-27600-CF7CA675; Wed, 22 Jun 2016 17:16:44 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprEIsWRWlGSWpSXmKPExsXitHSDve7v41n hBn8PKlks+biYxYHR4+ju30wBjFGsmXlJ+RUJrBmfp05hLvgtUDHv1TvGBsYLvF2MnBwSAv4S 3ZemMIPYbAIGEiumX2UEsUUEZCVWd81h72Lk4mAWOMIocevmT7CEsICLxNuJe1hAbBYBVYmzH 24wgdi8ArYSP64+YIMYKifRcP4+2FBOATuJZa96wOJCQDW3FyxghLDVJG4sXMYC0SsocXLmEz CbWUBC4uCLF8wQc7glbp+eyjyBkW8WkrJZSMoWMDKtYtQoTi0qSy3SNbTQSyrKTM8oyU3MzNE 1NDTRy00tLk5MT81JTCrWS87P3cQIDKt6BgbGHYxHtnseYpTkYFIS5WXclhUuxJeUn1KZkVic EV9UmpNafIhRhoNDSYKX8yhQTrAoNT21Ii0zBxjgMGkJDh4lEV59kDRvcUFibnFmOkTqFKOil DgvA0hCACSRUZoH1waLqkuMslLCvIwMDAxCPAWpRbmZJajyrxjFORiVhHkNQKbwZOaVwE1/Bb SYCWjxsv50kMUliQgpqQbG3H+JpZdFs/dXB7Od5Iq0LPRnTAk3escnuC5c5YrMrvfaPEtZ8oz FDXk+5x+/KvxjhpSzyZltaUfubKv4HG4Vk3wqVD9BOU5581b9K5O/Niyy6/x09GngN0aBoj3d 7yd6f8uX10vde2rT+i39nzXiUk/07ejKCl+RL7Fnb7zaq4WLI3f1phgosRRnJBpqMRcVJwIAw QHE4KUCAAA= X-Env-Sender: prvs=9742ee4c2=anthony.perard@citrix.com X-Msg-Ref: server-14.tower-27.messagelabs.com!1466615801!37129849!2 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 8.46; banners=-,-,- X-VirusChecked: Checked Received: (qmail 37393 invoked from network); 22 Jun 2016 17:16:43 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-14.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 22 Jun 2016 17:16:43 -0000 X-IronPort-AV: E=Sophos;i="5.26,509,1459814400"; d="scan'208";a="369016604" From: Anthony PERARD To: Date: Wed, 22 Jun 2016 18:15:38 +0100 Message-ID: <20160622171545.5304-8-anthony.perard@citrix.com> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20160622171545.5304-1-anthony.perard@citrix.com> References: <20160622171545.5304-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 v5 07/14] 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 --- 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 | 5 +++++ tools/firmware/hvmloader/util.h | 3 +++ 2 files changed, 8 insertions(+) diff --git a/tools/firmware/hvmloader/hvmloader.c b/tools/firmware/hvmloader/hvmloader.c index 716d03c..c45f367 100644 --- a/tools/firmware/hvmloader/hvmloader.c +++ b/tools/firmware/hvmloader/hvmloader.c @@ -29,6 +29,8 @@ #include #include +const struct hvm_start_info *hvm_start_info; + asm ( " .text \n" " .globl _start \n" @@ -46,6 +48,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 +262,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);