From owner-freebsd-current@FreeBSD.ORG Fri Dec 20 15:23:12 2013 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F0BEFFE5 for ; Fri, 20 Dec 2013 15:23:11 +0000 (UTC) Received: from mail-wi0-f172.google.com (mail-wi0-f172.google.com [209.85.212.172]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 824611DD9 for ; Fri, 20 Dec 2013 15:23:11 +0000 (UTC) Received: by mail-wi0-f172.google.com with SMTP id en1so8526809wid.17 for ; Fri, 20 Dec 2013 07:23:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=pDbyOqmTxnsX9at/P6fQnqhK9TX8H8XGEq/224LjTrs=; b=AOhC7N8JAiJ6dfRQB+28igI0M+ZT2XXlGPJPSnft/WRLolU6sEwvezPF+UM5cyrqp/ vbISgmFR5noZ37H/WebvgLf2IgIEj5S+lABnu16d6zEtZSb40n7puZdYHG1mNZbq75ea 20a1Cb4aeZmbEF02fMv/WuZFwgygmle4oB9h1k7iQiSzagLXQ6S7lS8taWJq9xGg/9s0 0MB74uhQujXCH/1C6bOSp9euxk0HiCNwFwvKWyl7273H+2vyc5UX9npvf8vnxOVourq7 bdbNfTJIIBOEGdhybHyo5RDNKUSzY8ePnZzXq3NjsG1OmQOtaCQjhisWa0n3Egi2N8sQ Y4Aw== X-Gm-Message-State: ALoCoQlN4sO16RlYoweuE5t4A75hf0qbbpYTFOHDwnjqALf4HDvYCsTTDC0T+X3lWU/ZRzh8pJL2 X-Received: by 10.194.10.34 with SMTP id f2mr2369870wjb.77.1387552536580; Fri, 20 Dec 2013 07:15:36 -0800 (PST) Received: from [192.168.42.155] ([80.215.9.126]) by mx.google.com with ESMTPSA id pl7sm2770199wjc.16.2013.12.20.07.15.32 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 20 Dec 2013 07:15:34 -0800 (PST) Message-ID: <52B45F11.1030504@linaro.org> Date: Fri, 20 Dec 2013 15:15:29 +0000 From: Julien Grall User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Roger Pau Monne , freebsd-xen@freebsd.org, freebsd-current@freebsd.org, xen-devel@lists.xen.org, gibbs@freebsd.org, jhb@freebsd.org, kib@freebsd.org, julien.grall@citrix.com Subject: Re: [Xen-devel] [PATCH v7 01/19] xen: add PV/PVH kernel entry point References: <1387479296-33389-1-git-send-email-roger.pau@citrix.com> <1387479296-33389-2-git-send-email-roger.pau@citrix.com> In-Reply-To: <1387479296-33389-2-git-send-email-roger.pau@citrix.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Fri, 20 Dec 2013 16:20:29 +0000 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Dec 2013 15:23:12 -0000 On 12/19/2013 06:54 PM, Roger Pau Monne wrote: > Add the PV/PVH entry point and the low level functions for PVH > initialization. > --- > sys/amd64/amd64/locore.S | 53 +++++++++++++++++++++++++++++++ > sys/amd64/amd64/machdep.c | 72 ++++++++++++++++++++++++++++++++++++++++++ > sys/amd64/include/asmacros.h | 26 +++++++++++++++ > sys/i386/xen/xen_machdep.c | 2 + > sys/x86/xen/hvm.c | 1 + > sys/xen/xen-os.h | 4 ++ > 6 files changed, 158 insertions(+), 0 deletions(-) > [..] > diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c > index eae657b..a73e33e 100644 > --- a/sys/amd64/amd64/machdep.c > +++ b/sys/amd64/amd64/machdep.c > @@ -146,10 +146,17 @@ __FBSDID("$FreeBSD$"); > #include > #include > > +#ifdef XENHVM > +#include > +#endif > + > /* Sanity check for __curthread() */ > CTASSERT(offsetof(struct pcpu, pc_curthread) == 0); > > extern u_int64_t hammer_time(u_int64_t, u_int64_t); > +#ifdef XENHVM > +extern u_int64_t hammer_time_xen(start_info_t *, u_int64_t); > +#endif > > extern void printcpuinfo(void); /* XXX header file */ > extern void identify_cpu(void); > @@ -1683,6 +1690,71 @@ do_next: > msgbufp = (struct msgbuf *)PHYS_TO_DMAP(phys_avail[pa_indx]); > } > > +#ifdef XENHVM > +/* > + * First function called by the Xen PVH boot sequence. > + * > + * Set some Xen global variables and prepare the environment so it is > + * as similar as possible to what native FreeBSD init function expects. > + */ > +u_int64_t > +hammer_time_xen(start_info_t *si, u_int64_t xenstack) > +{ > + u_int64_t physfree; > + u_int64_t *PT4 = (u_int64_t *)xenstack; > + u_int64_t *PT3 = (u_int64_t *)(xenstack + PAGE_SIZE); > + u_int64_t *PT2 = (u_int64_t *)(xenstack + 2 * PAGE_SIZE); > + int i; > + > + KASSERT((si != NULL && xenstack != 0), > + ("invalid start_info or xenstack")); If I'm not mistaken, the user won't see the error if the assert failed (the console is not yet initialized). Perhaps xc_printf is more suitable here. -- Julien Grall