Changeset View
Changeset View
Standalone View
Standalone View
lib/libkvm/kvm_i386.h
- This file was added.
/*- | |||||
* Copyright (c) 1989, 1992, 1993 | |||||
* The Regents of the University of California. All rights reserved. | |||||
* | |||||
* This code is derived from software developed by the Computer Systems | |||||
* Engineering group at Lawrence Berkeley Laboratory under DARPA contract | |||||
* BG 91-66 and contributed to Berkeley. | |||||
* | |||||
* 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. | |||||
* 4. Neither the name of the University nor the names of its contributors | |||||
* may be used to endorse or promote products derived from this software | |||||
* without specific prior written permission. | |||||
* | |||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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$ | |||||
*/ | |||||
#ifndef __KVM_I386_H__ | |||||
#define __KVM_I386_H__ | |||||
#ifdef __i386__ | |||||
#include <vm/vm.h> | |||||
#include <vm/pmap.h> | |||||
#endif | |||||
typedef uint32_t i386_physaddr_t; | |||||
typedef uint32_t i386_pte_t; | |||||
typedef uint32_t i386_pde_t; | |||||
typedef uint64_t i386_physaddr_pae_t; | |||||
typedef uint64_t i386_pte_pae_t; | |||||
typedef uint64_t i386_pde_pae_t; | |||||
#define I386_PAGE_SHIFT 12 | |||||
#define I386_PAGE_SIZE (1 << I386_PAGE_SHIFT) | |||||
#define I386_PAGE_MASK (I386_PAGE_SIZE - 1) | |||||
#define I386_NPTEPG (I386_PAGE_SIZE / sizeof(i386_pte_t)) | |||||
#define I386_PDRSHIFT 22 | |||||
#define I386_NBPDR (1 << I386_PDRSHIFT) | |||||
#define I386_PAGE_PS_MASK (I386_NBPDR - 1) | |||||
#define I386_NPTEPG_PAE (I386_PAGE_SIZE / sizeof(i386_pte_pae_t)) | |||||
#define I386_PDRSHIFT_PAE 21 | |||||
#define I386_NBPDR_PAE (1 << I386_PDRSHIFT_PAE) | |||||
#define I386_PAGE_PS_MASK_PAE (I386_NBPDR_PAE - 1) | |||||
#define I386_PG_V 0x001 | |||||
#define I386_PG_PS 0x080 | |||||
#define I386_PG_FRAME_PAE (0x000ffffffffff000ull) | |||||
#define I386_PG_PS_FRAME_PAE (0x000fffffffe00000ull) | |||||
#define I386_PG_FRAME (0xfffff000) | |||||
#define I386_PG_PS_FRAME (0xffc00000) | |||||
#ifdef __i386__ | |||||
_Static_assert(PAGE_SHIFT == I386_PAGE_SHIFT, "PAGE_SHIFT mismatch"); | |||||
_Static_assert(PAGE_SIZE == I386_PAGE_SIZE, "PAGE_SIZE mismatch"); | |||||
_Static_assert(PAGE_MASK == I386_PAGE_MASK, "PAGE_MASK mismatch"); | |||||
_Static_assert(NPTEPG == I386_NPTEPG, "NPTEPG mismatch"); | |||||
_Static_assert(PDRSHIFT == I386_PDRSHIFT, "PDRSHIFT mismatch"); | |||||
_Static_assert(NBPDR == I386_NBPDR, "NBPDR mismatch"); | |||||
_Static_assert(PG_V == I386_PG_V, "PG_V mismatch"); | |||||
_Static_assert(PG_PS == I386_PG_PS, "PG_PS mismatch"); | |||||
_Static_assert(PG_FRAME == I386_PG_FRAME, "PG_FRAME mismatch"); | |||||
_Static_assert(PG_PS_FRAME == I386_PG_PS_FRAME, "PG_PS_FRAME mismatch"); | |||||
#endif | |||||
int _i386_native(kvm_t *); | |||||
#endif /* !__KVM_I386_H__ */ |