[Xen-devel] [PATCH v7 01/19] xen: add PV/PVH kernel entry point
Julien Grall
julien.grall at linaro.org
Fri Dec 20 15:23:12 UTC 2013
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
More information about the freebsd-current
mailing list