From patchwork Mon Mar 14 17:55:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony PERARD X-Patchwork-Id: 8582531 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 845469F54C for ; Mon, 14 Mar 2016 17:58:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9F8852013D for ; Mon, 14 Mar 2016 17:58:06 +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 C57B4200FE for ; Mon, 14 Mar 2016 17:58:05 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xen.org with esmtp (Exim 4.84) (envelope-from ) id 1afWj3-0004z6-NX; Mon, 14 Mar 2016 17:56:17 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.84) (envelope-from ) id 1afWj1-0004ri-NJ for xen-devel@lists.xen.org; Mon, 14 Mar 2016 17:56:15 +0000 Received: from [85.158.139.211] by server-11.bemta-5.messagelabs.com id F7/E0-17208-F3BF6E65; Mon, 14 Mar 2016 17:56:15 +0000 X-Env-Sender: prvs=874c279eb=anthony.perard@citrix.com X-Msg-Ref: server-13.tower-206.messagelabs.com!1457978168!28652985!4 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.11; banners=-,-,- X-VirusChecked: Checked Received: (qmail 36297 invoked from network); 14 Mar 2016 17:56:14 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-13.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 14 Mar 2016 17:56:14 -0000 X-IronPort-AV: E=Sophos;i="5.24,336,1454976000"; d="scan'208";a="345467649" From: Anthony PERARD To: Date: Mon, 14 Mar 2016 17:55:42 +0000 Message-ID: <1457978150-27201-8-git-send-email-anthony.perard@citrix.com> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1457978150-27201-1-git-send-email-anthony.perard@citrix.com> References: <1457978150-27201-1-git-send-email-anthony.perard@citrix.com> MIME-Version: 1.0 X-DLP: MIA1 Cc: Keir Fraser , Stefano Stabellini , Andrew Cooper , Ian Jackson , Jan Beulich , Anthony PERARD , Wei Liu Subject: [Xen-devel] [PATCH v4 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-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, 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 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);