From patchwork Tue Jul 12 14:42:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony PERARD X-Patchwork-Id: 9225535 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 AFA3E6086B for ; Tue, 12 Jul 2016 14:48:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A134F27D29 for ; Tue, 12 Jul 2016 14:48:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 95DDB27DCD; Tue, 12 Jul 2016 14:48:57 +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 DA51327D29 for ; Tue, 12 Jul 2016 14:48:56 +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 1bMyxB-0003te-6n; Tue, 12 Jul 2016 14:46:29 +0000 Received: from mail6.bemta6.messagelabs.com ([85.158.143.247]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bMyx9-0003tK-Me for xen-devel@lists.xen.org; Tue, 12 Jul 2016 14:46:27 +0000 Received: from [85.158.143.35] by server-3.bemta-6.messagelabs.com id CD/BC-22092-3C205875; Tue, 12 Jul 2016 14:46:27 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprIIsWRWlGSWpSXmKPExsXitHSDve4hptZ wgyMP1C2WfFzM4sDocXT3b6YAxijWzLyk/IoE1ozmZ8vYCk4IVjyd/4mlgXE1XxcjJ4eEgL/E oreXGUFsNgEDiRXTr4LZIgKyEqu75rB3MXJxMAscYZS4dfMnWEJYwEXiw71+MJtFQFVi3rO1r CA2r4CNxN5ZrYwQQ+UkGs7fZwaxOQVsJdpan4LZQkA1a5fOYoWw1SRuLFzGAtErKHFy5hMwm1 lAQuLgixfMEHO4JW6fnso8gZFvFpKyWUjKFjAyrWJUL04tKkst0jXSSyrKTM8oyU3MzNE1NDD Ty00tLk5MT81JTCrWS87P3cQIDCoGINjBuOyv0yFGSQ4mJVHeZuaWcCG+pPyUyozE4oz4otKc 1OJDjDIcHEoSvCcZW8OFBItS01Mr0jJzgOENk5bg4FES4f0CkuYtLkjMLc5Mh0idYlSUEuc9D pIQAElklObBtcFi6hKjrJQwLyPQIUI8BalFuZklqPKvGMU5GJWEec+ATOHJzCuBm/4KaDET0O Jah2aQxSWJCCmpBsZaA4ZLE2Pm37Ne26bxn3+NyK1ztw4/sn7du0Ywfub1wKOP+H7YytT+Kni 6MXfJda5t26/ztx/MYd7zev97Bcspb+TO689sPP25OKi2On1jW0yAz+HovNI/PedXxfNNMtKY 9/Lnzs58+zT5ew1VagXG+1eYpbybfHyjR/GBS86eDlxKSTo7lK4osRRnJBpqMRcVJwIA1Il4j qQCAAA= X-Env-Sender: prvs=994f31c19=anthony.perard@citrix.com X-Msg-Ref: server-2.tower-21.messagelabs.com!1468334785!9588118!1 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.77; banners=-,-,- X-VirusChecked: Checked Received: (qmail 37287 invoked from network); 12 Jul 2016 14:46:26 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-2.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 12 Jul 2016 14:46:26 -0000 X-IronPort-AV: E=Sophos;i="5.28,352,1464652800"; d="scan'208";a="372679188" From: Anthony PERARD To: Date: Tue, 12 Jul 2016 15:42:44 +0100 Message-ID: <20160712144251.558-8-anthony.perard@citrix.com> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20160712144251.558-1-anthony.perard@citrix.com> References: <20160712144251.558-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 v6 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 --- 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);