Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Dec 2013 15:15:29 +0000
From:      Julien Grall <julien.grall@linaro.org>
To:        Roger Pau Monne <roger.pau@citrix.com>, 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
Message-ID:  <52B45F11.1030504@linaro.org>
In-Reply-To: <1387479296-33389-2-git-send-email-roger.pau@citrix.com>
References:  <1387479296-33389-1-git-send-email-roger.pau@citrix.com> <1387479296-33389-2-git-send-email-roger.pau@citrix.com>

next in thread | previous in thread | raw e-mail | index | archive | help


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 <isa/isareg.h>
>   #include <isa/rtc.h>
>
> +#ifdef XENHVM
> +#include <xen/xen-os.h>
> +#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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?52B45F11.1030504>