Re: [Xen-devel] [PATCH v7 01/19] xen: add PV/PVH kernel entry point

From: Julien Grall <julien.grall_at_linaro.org>
Date: Fri, 20 Dec 2013 15:15:29 +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
> _at__at_ -146,10 +146,17 _at__at_ __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);
> _at__at_ -1683,6 +1690,71 _at__at_ 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
Received on Fri Dec 20 2013 - 14:23:12 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:45 UTC