hat_pte.h revision 935f8dd067f153d79df90aeaa4b0f87c59c60cec
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _VM_HAT_PTE_H
#define _VM_HAT_PTE_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/mach_mmu.h>
/*
*/
#define PTE_SET(p, f) ((p) |= (f))
#define PTE_GET(p, f) ((p) & (f))
/*
* Handy macro to check if a pagetable entry or pointer is valid
*/
/*
* Does a PTE map a large page.
*/
/*
* does this PTE represent a page (not a pointer to another page table)?
*/
#define PTE_ISPAGE(p, l) \
/*
*/
/*
* Shorthand for converting a PTE to it's pfn.
*/
#define PTE2MFN(p, l) \
#define PT_NX (0x8000000000000000ull)
#define PT_PADDR (0x000ffffffffff000ull)
/*
* Macros to create a PTP or PTE from the pfn and level
*/
/*
* The idea of "level" refers to the level where the page table is used in the
* the hardware address translation steps. The level values correspond to the
*
* ---------------------- -------
* Page Map Level 4 3
* Page Directory Pointer 2
* Page Directory 1
* Page Table 0
*
* The numbering scheme is such that the values of 0 and 1 can correspond to
* the pagesize codes used for MPSS support. For now the Maximum level at
* which you can have a large page is a constant, that may change in
* future processors.
*
* The type of "level_t" is signed so that it can be used like:
* level_t l;
* ...
* while (--l >= 0)
* ...
*/
#define MAX_NUM_LEVEL 4
/*
* Macros to:
* Check for a PFN above 4Gig and 64Gig for 32 bit PAE support
*/
/*
* The CR3 register holds the physical address of the top level page table.
*/
/*
*/
struct htable;
struct hat_mmu_info {
/*
* See PWIN_XXX macros.
*/
/*
* The following tables are equivalent to PAGEXXXXX at different levels
* in the page table hierarchy.
*/
};
#if defined(_KERNEL)
/*
* Macros to access the HAT's private page windows. They're used for
* accessing pagetables, ppcopy() and page_zero().
* The 1st two macros are used to get an index for the particular use.
* The next three give you:
* - the virtual address of the window
* - the virtual address of the pte that maps the window
* - the physical address of the pte that map the window
*/
/*
* The concept of a VA hole exists in AMD64. This might need to be made
* model specific eventually.
*
* In the 64 bit kernel PTE loads are atomic, but need cas64 on 32 bit kernel.
*/
#if defined(__amd64)
#ifdef lint
#else
#endif
#define FMT_PTE "0x%lx"
#define FMT_PTE "0x%llx"
/* on 32 bit kernels, 64 bit loads aren't atomic, use get_pte64() */
#endif /* __i386 */
/*
* Return a pointer to the pte entry at the given index within a page table.
*/
#define PT_INDEX_PTR(p, x) \
/*
* Return the physical address of the pte entry at the given index within a
* page table.
*/
#define PT_INDEX_PHYSADDR(p, x) \
/*
* From pfn to bytes, careful not to lose bits on PAE.
*/
extern struct hat_mmu_info mmu;
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _VM_HAT_PTE_H */