Add the PV/PVH entry point and the low level functions for PVH early initialization. Approved by: gibbs Sponsored by: Citrix Systems R&D amd64/amd64/genassym.c: - Add __FreeBSD_version define to assym.s so it can be used for the Xen notes. amd64/amd64/locore.S: - Make bootstack global so it can be used from Xen kernel entry point. amd64/amd64/xen-locore.S: - Add Xen notes to the kernel. - Add the Xen PV entry point, that is going to call hammer_time_xen. amd64/include/asmacros.h: - Add ELFNOTE macros. i386/xen/xen_machdep.c: - Define HYPERVISOR_start_info for the XEN i386 PV port, which is going to be used in some shared code between PV and PVH. x86/xen/hvm.c: - Define HYPERVISOR_start_info for the PVH port. x86/xen/pv.c: - Introduce hammer_time_xen which is going to perform early setup for Xen PVH: - Setup shared Xen variables start_info, shared_info and xen_store. - Set guest type. - Create initial page tables as FreeBSD expects to find them. - Call into native init function (hammer_time). xen/xen-os.h: - Declare HYPERVISOR_start_info. conf/files.amd64: - Add amd64/amd64/locore.S and x86/xen/pv.c to the list of files.
90 lines
3.0 KiB
ArmAsm
90 lines
3.0 KiB
ArmAsm
/*-
|
|
* Copyright (c) 2003 Peter Wemm <peter@FreeBSD.org>
|
|
* All rights reserved.
|
|
*
|
|
* Redistribution and use in source and binary forms, with or without
|
|
* modification, are permitted provided that the following conditions
|
|
* are met:
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
* notice, this list of conditions and the following disclaimer.
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
* documentation and/or other materials provided with the distribution.
|
|
*
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
* SUCH DAMAGE.
|
|
*
|
|
* $FreeBSD$
|
|
*/
|
|
|
|
#include <machine/asmacros.h>
|
|
#include <machine/psl.h>
|
|
#include <machine/pmap.h>
|
|
#include <machine/specialreg.h>
|
|
|
|
#include "assym.s"
|
|
|
|
/*
|
|
* Compiled KERNBASE location
|
|
*/
|
|
.globl kernbase,loc_PTmap,loc_PDmap,loc_PDPmap,loc_PML4map,loc_PML4pml4e,dmapbase,dmapend
|
|
.set kernbase,KERNBASE
|
|
.set loc_PTmap,addr_PTmap
|
|
.set loc_PDmap,addr_PDmap
|
|
.set loc_PDPmap,addr_PDPmap
|
|
.set loc_PML4map,addr_PML4map
|
|
.set loc_PML4pml4e,addr_PML4pml4e
|
|
.set dmapbase,DMAP_MIN_ADDRESS
|
|
.set dmapend,DMAP_MAX_ADDRESS
|
|
|
|
.text
|
|
/**********************************************************************
|
|
*
|
|
* This is where the loader trampoline start us, set the ball rolling...
|
|
*
|
|
* We are called with the stack looking like this:
|
|
* 0(%rsp) = 32 bit return address (cannot be used)
|
|
* 4(%rsp) = 32 bit modulep
|
|
* 8(%rsp) = 32 bit kernend
|
|
*
|
|
* We are already in long mode, on a 64 bit %cs and running at KERNBASE.
|
|
*/
|
|
NON_GPROF_ENTRY(btext)
|
|
|
|
/* Tell the bios to warmboot next time */
|
|
movw $0x1234,0x472
|
|
|
|
/* Don't trust what the loader gives for rflags. */
|
|
pushq $PSL_KERNEL
|
|
popfq
|
|
|
|
/* Find the metadata pointers before we lose them */
|
|
movq %rsp, %rbp
|
|
movl 4(%rbp),%edi /* modulep (arg 1) */
|
|
movl 8(%rbp),%esi /* kernend (arg 2) */
|
|
|
|
/* Get onto a stack that we can trust - there is no going back now. */
|
|
movq $bootstack,%rsp
|
|
xorl %ebp, %ebp
|
|
|
|
call hammer_time /* set up cpu for unix operation */
|
|
movq %rax,%rsp /* set up kstack for mi_startup() */
|
|
call mi_startup /* autoconfiguration, mountroot etc */
|
|
0: hlt
|
|
jmp 0b
|
|
|
|
.bss
|
|
ALIGN_DATA /* just to be sure */
|
|
.globl bootstack
|
|
.space 0x1000 /* space for bootstack - temporary stack */
|
|
bootstack:
|