Home | History | Annotate | Line # | Download | only in include
pmap.h revision 1.60
      1  1.60   thorpej /*	$NetBSD: pmap.h,v 1.60 2002/07/17 14:31:46 thorpej Exp $ */
      2   1.8   deraadt 
      3   1.1   deraadt /*
      4  1.20        pk  * Copyright (c) 1996
      5  1.21    abrown  * 	The President and Fellows of Harvard College. All rights reserved.
      6   1.1   deraadt  * Copyright (c) 1992, 1993
      7   1.1   deraadt  *	The Regents of the University of California.  All rights reserved.
      8   1.1   deraadt  *
      9   1.1   deraadt  * This software was developed by the Computer Systems Engineering group
     10   1.1   deraadt  * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
     11   1.1   deraadt  * contributed to Berkeley.
     12   1.1   deraadt  *
     13   1.1   deraadt  * All advertising materials mentioning features or use of this software
     14   1.1   deraadt  * must display the following acknowledgement:
     15  1.20        pk  *	This product includes software developed by Aaron Brown and
     16  1.20        pk  *	Harvard University.
     17   1.1   deraadt  *	This product includes software developed by the University of
     18   1.1   deraadt  *	California, Lawrence Berkeley Laboratory.
     19   1.1   deraadt  *
     20  1.20        pk  * @InsertRedistribution@
     21   1.1   deraadt  * 3. All advertising materials mentioning features or use of this software
     22   1.1   deraadt  *    must display the following acknowledgement:
     23  1.20        pk  *	This product includes software developed by Aaron Brown and
     24  1.20        pk  *	Harvard University.
     25   1.1   deraadt  *	This product includes software developed by the University of
     26   1.1   deraadt  *	California, Berkeley and its contributors.
     27   1.1   deraadt  * 4. Neither the name of the University nor the names of its contributors
     28   1.1   deraadt  *    may be used to endorse or promote products derived from this software
     29   1.1   deraadt  *    without specific prior written permission.
     30   1.1   deraadt  *
     31   1.1   deraadt  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     32   1.1   deraadt  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     33   1.1   deraadt  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     34   1.1   deraadt  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     35   1.1   deraadt  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     36   1.1   deraadt  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     37   1.1   deraadt  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     38   1.1   deraadt  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     39   1.1   deraadt  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     40   1.1   deraadt  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     41   1.1   deraadt  * SUCH DAMAGE.
     42   1.1   deraadt  *
     43   1.1   deraadt  *	@(#)pmap.h	8.1 (Berkeley) 6/11/93
     44   1.1   deraadt  */
     45   1.1   deraadt 
     46   1.1   deraadt #ifndef	_SPARC_PMAP_H_
     47   1.1   deraadt #define _SPARC_PMAP_H_
     48  1.59   darrenr 
     49  1.59   darrenr #if defined(_KERNEL_OPT)
     50  1.59   darrenr #include "opt_sparc_arch.h"
     51  1.59   darrenr #endif
     52   1.1   deraadt 
     53   1.1   deraadt #include <machine/pte.h>
     54   1.1   deraadt 
     55   1.1   deraadt /*
     56   1.1   deraadt  * Pmap structure.
     57   1.1   deraadt  *
     58   1.1   deraadt  * The pmap structure really comes in two variants, one---a single
     59   1.1   deraadt  * instance---for kernel virtual memory and the other---up to nproc
     60   1.1   deraadt  * instances---for user virtual memory.  Unfortunately, we have to mash
     61   1.1   deraadt  * both into the same structure.  Fortunately, they are almost the same.
     62   1.1   deraadt  *
     63   1.1   deraadt  * The kernel begins at 0xf8000000 and runs to 0xffffffff (although
     64   1.1   deraadt  * some of this is not actually used).  Kernel space, including DVMA
     65   1.1   deraadt  * space (for now?), is mapped identically into all user contexts.
     66   1.1   deraadt  * There is no point in duplicating this mapping in each user process
     67   1.1   deraadt  * so they do not appear in the user structures.
     68   1.1   deraadt  *
     69   1.1   deraadt  * User space begins at 0x00000000 and runs through 0x1fffffff,
     70   1.1   deraadt  * then has a `hole', then resumes at 0xe0000000 and runs until it
     71   1.1   deraadt  * hits the kernel space at 0xf8000000.  This can be mapped
     72   1.1   deraadt  * contiguously by ignorning the top two bits and pretending the
     73   1.1   deraadt  * space goes from 0 to 37ffffff.  Typically the lower range is
     74   1.1   deraadt  * used for text+data and the upper for stack, but the code here
     75   1.1   deraadt  * makes no such distinction.
     76   1.1   deraadt  *
     77   1.1   deraadt  * Since each virtual segment covers 256 kbytes, the user space
     78   1.1   deraadt  * requires 3584 segments, while the kernel (including DVMA) requires
     79   1.1   deraadt  * only 512 segments.
     80   1.1   deraadt  *
     81  1.20        pk  *
     82  1.20        pk  ** FOR THE SUN4/SUN4C
     83  1.20        pk  *
     84   1.1   deraadt  * The segment map entry for virtual segment vseg is offset in
     85   1.1   deraadt  * pmap->pm_rsegmap by 0 if pmap is not the kernel pmap, or by
     86   1.1   deraadt  * NUSEG if it is.  We keep a pointer called pmap->pm_segmap
     87   1.1   deraadt  * pre-offset by this value.  pmap->pm_segmap thus contains the
     88   1.1   deraadt  * values to be loaded into the user portion of the hardware segment
     89   1.1   deraadt  * map so as to reach the proper PMEGs within the MMU.  The kernel
     90   1.1   deraadt  * mappings are `set early' and are always valid in every context
     91   1.1   deraadt  * (every change is always propagated immediately).
     92   1.1   deraadt  *
     93   1.1   deraadt  * The PMEGs within the MMU are loaded `on demand'; when a PMEG is
     94   1.1   deraadt  * taken away from context `c', the pmap for context c has its
     95   1.1   deraadt  * corresponding pm_segmap[vseg] entry marked invalid (the MMU segment
     96   1.1   deraadt  * map entry is also made invalid at the same time).  Thus
     97   1.1   deraadt  * pm_segmap[vseg] is the `invalid pmeg' number (127 or 511) whenever
     98   1.1   deraadt  * the corresponding PTEs are not actually in the MMU.  On the other
     99   1.1   deraadt  * hand, pm_pte[vseg] is NULL only if no pages in that virtual segment
    100   1.1   deraadt  * are in core; otherwise it points to a copy of the 32 or 64 PTEs that
    101   1.1   deraadt  * must be loaded in the MMU in order to reach those pages.
    102   1.1   deraadt  * pm_npte[vseg] counts the number of valid pages in each vseg.
    103   1.1   deraadt  *
    104   1.1   deraadt  * XXX performance: faster to count valid bits?
    105   1.1   deraadt  *
    106   1.1   deraadt  * The kernel pmap cannot malloc() PTEs since malloc() will sometimes
    107   1.1   deraadt  * allocate a new virtual segment.  Since kernel mappings are never
    108  1.44     soren  * `stolen' out of the MMU, we just keep all its PTEs there, and have
    109  1.44     soren  * no software copies.  Its mmu entries are nonetheless kept on lists
    110   1.1   deraadt  * so that the code that fiddles with mmu lists has something to fiddle.
    111  1.20        pk  *
    112  1.60   thorpej  ** FOR THE SUN4M/SUN4D
    113  1.20        pk  *
    114  1.20        pk  * On this architecture, the virtual-to-physical translation (page) tables
    115  1.20        pk  * are *not* stored within the MMU as they are in the earlier Sun architect-
    116  1.20        pk  * ures; instead, they are maintained entirely within physical memory (there
    117  1.20        pk  * is a TLB cache to prevent the high performance hit from keeping all page
    118  1.20        pk  * tables in core). Thus there is no need to dynamically allocate PMEGs or
    119  1.20        pk  * SMEGs; only contexts must be shared.
    120  1.20        pk  *
    121  1.20        pk  * We maintain two parallel sets of tables: one is the actual MMU-edible
    122  1.20        pk  * hierarchy of page tables in allocated kernel memory; these tables refer
    123  1.20        pk  * to each other by physical address pointers in SRMMU format (thus they
    124  1.20        pk  * are not very useful to the kernel's management routines). The other set
    125  1.20        pk  * of tables is similar to those used for the Sun4/100's 3-level MMU; it
    126  1.20        pk  * is a hierarchy of regmap and segmap structures which contain kernel virtual
    127  1.20        pk  * pointers to each other. These must (unfortunately) be kept in sync.
    128  1.20        pk  *
    129   1.1   deraadt  */
    130  1.15        pk #define NKREG	((int)((-(unsigned)KERNBASE) / NBPRG))	/* i.e., 8 */
    131  1.15        pk #define NUREG	(256 - NKREG)				/* i.e., 248 */
    132  1.15        pk 
    133  1.15        pk TAILQ_HEAD(mmuhd,mmuentry);
    134   1.1   deraadt 
    135  1.20        pk /*
    136  1.20        pk  * data appearing in both user and kernel pmaps
    137  1.20        pk  *
    138  1.20        pk  * note: if we want the same binaries to work on the 4/4c and 4m, we have to
    139  1.20        pk  *       include the fields for both to make sure that the struct kproc
    140  1.20        pk  * 	 is the same size.
    141  1.20        pk  */
    142   1.5        pk struct pmap {
    143   1.5        pk 	union	ctxinfo *pm_ctx;	/* current context, if any */
    144   1.5        pk 	int	pm_ctxnum;		/* current context's number */
    145  1.56       chs 	struct simplelock pm_lock;	/* spinlock */
    146   1.5        pk 	int	pm_refcount;		/* just what it says */
    147  1.15        pk 
    148  1.20        pk 	struct mmuhd	pm_reglist;	/* MMU regions on this pmap (4/4c) */
    149  1.20        pk 	struct mmuhd	pm_seglist;	/* MMU segments on this pmap (4/4c) */
    150  1.20        pk 
    151  1.15        pk 	struct regmap	*pm_regmap;
    152  1.20        pk 
    153  1.42        pk 	int		**pm_reg_ptps;	/* SRMMU-edible region tables for 4m */
    154  1.42        pk 	int		*pm_reg_ptps_pa;/* _Physical_ address of pm_reg_ptps */
    155  1.20        pk 
    156  1.15        pk 	int		pm_gap_start;	/* Starting with this vreg there's */
    157  1.15        pk 	int		pm_gap_end;	/* no valid mapping until here */
    158  1.15        pk 
    159   1.6   deraadt 	struct pmap_statistics	pm_stats;	/* pmap statistics */
    160   1.1   deraadt };
    161   1.1   deraadt 
    162  1.15        pk struct regmap {
    163  1.15        pk 	struct segmap	*rg_segmap;	/* point to NSGPRG PMEGs */
    164  1.20        pk 	int		*rg_seg_ptps; 	/* SRMMU-edible segment tables (NULL
    165  1.20        pk 					 * indicates invalid region (4m) */
    166  1.20        pk 	smeg_t		rg_smeg;	/* the MMU region number (4c) */
    167  1.15        pk 	u_char		rg_nsegmap;	/* number of valid PMEGS */
    168   1.1   deraadt };
    169   1.1   deraadt 
    170  1.15        pk struct segmap {
    171  1.15        pk 	int	*sg_pte;		/* points to NPTESG PTEs */
    172  1.20        pk 	pmeg_t	sg_pmeg;		/* the MMU segment number (4c) */
    173  1.15        pk 	u_char	sg_npte;		/* number of valid PTEs per seg */
    174   1.1   deraadt };
    175   1.1   deraadt 
    176   1.3        pk typedef struct pmap *pmap_t;
    177   1.3        pk 
    178  1.20        pk #if 0
    179  1.20        pk struct kvm_cpustate {
    180  1.20        pk 	int		kvm_npmemarr;
    181  1.20        pk 	struct memarr	kvm_pmemarr[MA_SIZE];
    182  1.20        pk 	int		kvm_seginval;			/* [4,4c] */
    183  1.20        pk 	struct segmap	kvm_segmap_store[NKREG*NSEGRG];	/* [4,4c] */
    184  1.20        pk }/*not yet used*/;
    185  1.20        pk #endif
    186  1.20        pk 
    187  1.13       jtc #ifdef _KERNEL
    188   1.1   deraadt 
    189   1.1   deraadt #define PMAP_NULL	((pmap_t)0)
    190   1.1   deraadt 
    191   1.5        pk extern struct pmap	kernel_pmap_store;
    192  1.49        pk 
    193  1.49        pk /*
    194  1.49        pk  * Bounds on managed physical addresses. Used by (MD) users
    195  1.49        pk  * of uvm_pglistalloc() to provide search hints.
    196  1.49        pk  */
    197  1.49        pk extern paddr_t		vm_first_phys, vm_last_phys;
    198  1.49        pk extern psize_t		vm_num_phys;
    199   1.1   deraadt 
    200   1.1   deraadt /*
    201   1.1   deraadt  * Since PTEs also contain type bits, we have to have some way
    202   1.1   deraadt  * to tell pmap_enter `this is an IO page' or `this is not to
    203   1.1   deraadt  * be cached'.  Since physical addresses are always aligned, we
    204   1.1   deraadt  * can do this with the low order bits.
    205   1.1   deraadt  *
    206   1.1   deraadt  * The ordering below is important: PMAP_PGTYPE << PG_TNC must give
    207   1.1   deraadt  * exactly the PG_NC and PG_TYPE bits.
    208   1.1   deraadt  */
    209   1.1   deraadt #define	PMAP_OBIO	1		/* tells pmap_enter to use PG_OBIO */
    210   1.1   deraadt #define	PMAP_VME16	2		/* etc */
    211   1.1   deraadt #define	PMAP_VME32	3		/* etc */
    212   1.1   deraadt #define	PMAP_NC		4		/* tells pmap_enter to set PG_NC */
    213  1.26        pk #define	PMAP_TNC_4	7		/* mask to get PG_TYPE & PG_NC */
    214  1.26        pk 
    215  1.34        pk #define	PMAP_T2PTE_4(x)		(((x) & PMAP_TNC_4) << PG_TNC_SHIFT)
    216  1.34        pk #define	PMAP_IOENC_4(io)	(io)
    217  1.26        pk 
    218  1.26        pk /*
    219  1.26        pk  * On a SRMMU machine, the iospace is encoded in bits [3-6] of the
    220  1.26        pk  * physical address passed to pmap_enter().
    221  1.26        pk  */
    222  1.26        pk #define PMAP_TYPE_SRMMU		0x78	/* mask to get 4m page type */
    223  1.26        pk #define PMAP_PTESHFT_SRMMU	25	/* right shift to put type in pte */
    224  1.26        pk #define PMAP_SHFT_SRMMU		3	/* left shift to extract iospace */
    225  1.26        pk #define	PMAP_TNC_SRMMU		127	/* mask to get PG_TYPE & PG_NC */
    226   1.1   deraadt 
    227  1.20        pk /*#define PMAP_IOC      0x00800000      -* IO cacheable, NOT shifted */
    228  1.20        pk 
    229  1.26        pk #define PMAP_T2PTE_SRMMU(x)	(((x) & PMAP_TYPE_SRMMU) << PMAP_PTESHFT_SRMMU)
    230  1.26        pk #define PMAP_IOENC_SRMMU(io)	((io) << PMAP_SHFT_SRMMU)
    231  1.26        pk 
    232  1.26        pk /* Encode IO space for pmap_enter() */
    233  1.60   thorpej #define PMAP_IOENC(io)	(CPU_HAS_SRMMU ? PMAP_IOENC_SRMMU(io) \
    234  1.60   thorpej 				       : PMAP_IOENC_4(io))
    235  1.20        pk 
    236  1.20        pk int             pmap_dumpsize __P((void));
    237  1.20        pk int             pmap_dumpmmu __P((int (*)__P((dev_t, daddr_t, caddr_t, size_t)),
    238  1.20        pk                                  daddr_t));
    239   1.7   deraadt 
    240  1.14   mycroft #define	pmap_kernel()	(&kernel_pmap_store)
    241   1.7   deraadt #define	pmap_resident_count(pmap)	pmap_count_ptes(pmap)
    242   1.9        pk 
    243  1.18       gwr #define PMAP_PREFER(fo, ap)		pmap_prefer((fo), (ap))
    244  1.19  christos 
    245  1.20        pk #define PMAP_EXCLUDE_DECLS	/* tells MI pmap.h *not* to include decls */
    246  1.20        pk 
    247  1.20        pk /* FUNCTION DECLARATIONS FOR COMMON PMAP MODULE */
    248  1.20        pk 
    249  1.31   thorpej struct proc;
    250  1.31   thorpej void		pmap_activate __P((struct proc *));
    251  1.31   thorpej void		pmap_deactivate __P((struct proc *));
    252  1.20        pk void		pmap_bootstrap __P((int nmmu, int nctx, int nregion));
    253  1.20        pk int		pmap_count_ptes __P((struct pmap *));
    254  1.34        pk void		pmap_prefer __P((vaddr_t, vaddr_t *));
    255  1.34        pk int		pmap_pa_exists __P((paddr_t));
    256  1.38   thorpej void		pmap_unwire __P((pmap_t, vaddr_t));
    257  1.34        pk void		pmap_collect __P((pmap_t));
    258  1.34        pk void		pmap_copy __P((pmap_t, pmap_t, vaddr_t, vsize_t, vaddr_t));
    259  1.41       chs pmap_t		pmap_create __P((void));
    260  1.34        pk void		pmap_destroy __P((pmap_t));
    261  1.34        pk void		pmap_init __P((void));
    262  1.34        pk vaddr_t		pmap_map __P((vaddr_t, paddr_t, paddr_t, int));
    263  1.34        pk paddr_t		pmap_phys_address __P((int));
    264  1.34        pk void		pmap_reference __P((pmap_t));
    265  1.34        pk void		pmap_remove __P((pmap_t, vaddr_t, vaddr_t));
    266  1.58     chris #define		pmap_update(pmap)		/* nothing (yet) */
    267  1.34        pk void		pmap_virtual_space __P((vaddr_t *, vaddr_t *));
    268  1.20        pk void		pmap_redzone __P((void));
    269  1.20        pk void		kvm_uncache __P((caddr_t, int));
    270  1.19  christos struct user;
    271  1.39        pk int		mmu_pagein __P((struct pmap *pm, vaddr_t, int));
    272  1.30        pk void		pmap_writetext __P((unsigned char *, int));
    273  1.47        pk void		pmap_globalize_boot_cpuinfo __P((struct cpu_info *));
    274  1.30        pk 
    275  1.20        pk 
    276  1.20        pk /* SUN4/SUN4C SPECIFIC DECLARATIONS */
    277  1.20        pk 
    278  1.20        pk #if defined(SUN4) || defined(SUN4C)
    279  1.41       chs boolean_t	pmap_clear_modify4_4c __P((struct vm_page *));
    280  1.41       chs boolean_t	pmap_clear_reference4_4c __P((struct vm_page *));
    281  1.34        pk void		pmap_copy_page4_4c __P((paddr_t, paddr_t));
    282  1.43   thorpej int		pmap_enter4_4c __P((pmap_t, vaddr_t, paddr_t, vm_prot_t,
    283  1.43   thorpej 		    int));
    284  1.40   thorpej boolean_t	pmap_extract4_4c __P((pmap_t, vaddr_t, paddr_t *));
    285  1.41       chs boolean_t	pmap_is_modified4_4c __P((struct vm_page *));
    286  1.41       chs boolean_t	pmap_is_referenced4_4c __P((struct vm_page *));
    287  1.41       chs void		pmap_kenter_pa4_4c __P((vaddr_t, paddr_t, vm_prot_t));
    288  1.41       chs void		pmap_kremove4_4c __P((vaddr_t, vsize_t));
    289  1.41       chs void		pmap_page_protect4_4c __P((struct vm_page *, vm_prot_t));
    290  1.34        pk void		pmap_protect4_4c __P((pmap_t, vaddr_t, vaddr_t, vm_prot_t));
    291  1.34        pk void		pmap_zero_page4_4c __P((paddr_t));
    292  1.34        pk void		pmap_changeprot4_4c __P((pmap_t, vaddr_t, vm_prot_t, int));
    293  1.20        pk 
    294  1.60   thorpej #endif /* defined SUN4 || defined SUN4C */
    295  1.20        pk 
    296  1.60   thorpej /* SIMILAR DECLARATIONS FOR SUN4M/SUN4D MODULE */
    297  1.20        pk 
    298  1.60   thorpej #if defined(SUN4M) || defined(SUN4D)
    299  1.41       chs boolean_t	pmap_clear_modify4m __P((struct vm_page *));
    300  1.41       chs boolean_t	pmap_clear_reference4m __P((struct vm_page *));
    301  1.34        pk void		pmap_copy_page4m __P((paddr_t, paddr_t));
    302  1.45        pk void		pmap_copy_page_viking_mxcc(paddr_t, paddr_t);
    303  1.46        pk void		pmap_copy_page_hypersparc(paddr_t, paddr_t);
    304  1.43   thorpej int		pmap_enter4m __P((pmap_t, vaddr_t, paddr_t, vm_prot_t,
    305  1.43   thorpej 		    int));
    306  1.40   thorpej boolean_t	pmap_extract4m __P((pmap_t, vaddr_t, paddr_t *));
    307  1.41       chs boolean_t	pmap_is_modified4m __P((struct vm_page *));
    308  1.41       chs boolean_t	pmap_is_referenced4m __P((struct vm_page *));
    309  1.41       chs void		pmap_kenter_pa4m __P((vaddr_t, paddr_t, vm_prot_t));
    310  1.41       chs void		pmap_kremove4m __P((vaddr_t, vsize_t));
    311  1.41       chs void		pmap_page_protect4m __P((struct vm_page *, vm_prot_t));
    312  1.34        pk void		pmap_protect4m __P((pmap_t, vaddr_t, vaddr_t, vm_prot_t));
    313  1.34        pk void		pmap_zero_page4m __P((paddr_t));
    314  1.45        pk void		pmap_zero_page_viking_mxcc(paddr_t);
    315  1.46        pk void		pmap_zero_page_hypersparc(paddr_t);
    316  1.34        pk void		pmap_changeprot4m __P((pmap_t, vaddr_t, vm_prot_t, int));
    317  1.20        pk 
    318  1.60   thorpej #endif /* defined SUN4M || defined SUN4D */
    319  1.20        pk 
    320  1.60   thorpej #if !(defined(SUN4M) || defined(SUN4D)) && (defined(SUN4) || defined(SUN4C))
    321  1.20        pk 
    322  1.34        pk #define		pmap_clear_modify	pmap_clear_modify4_4c
    323  1.20        pk #define		pmap_clear_reference	pmap_clear_reference4_4c
    324  1.20        pk #define		pmap_enter		pmap_enter4_4c
    325  1.20        pk #define		pmap_extract		pmap_extract4_4c
    326  1.20        pk #define		pmap_is_modified	pmap_is_modified4_4c
    327  1.20        pk #define		pmap_is_referenced	pmap_is_referenced4_4c
    328  1.41       chs #define		pmap_kenter_pa		pmap_kenter_pa4_4c
    329  1.41       chs #define		pmap_kremove		pmap_kremove4_4c
    330  1.20        pk #define		pmap_page_protect	pmap_page_protect4_4c
    331  1.20        pk #define		pmap_protect		pmap_protect4_4c
    332  1.20        pk #define		pmap_changeprot		pmap_changeprot4_4c
    333  1.20        pk 
    334  1.60   thorpej #elif (defined(SUN4M) || defined(SUN4D)) && !(defined(SUN4) || defined(SUN4C))
    335  1.20        pk 
    336  1.34        pk #define		pmap_clear_modify	pmap_clear_modify4m
    337  1.20        pk #define		pmap_clear_reference	pmap_clear_reference4m
    338  1.20        pk #define		pmap_enter		pmap_enter4m
    339  1.20        pk #define		pmap_extract		pmap_extract4m
    340  1.20        pk #define		pmap_is_modified	pmap_is_modified4m
    341  1.20        pk #define		pmap_is_referenced	pmap_is_referenced4m
    342  1.41       chs #define		pmap_kenter_pa		pmap_kenter_pa4m
    343  1.41       chs #define		pmap_kremove		pmap_kremove4m
    344  1.20        pk #define		pmap_page_protect	pmap_page_protect4m
    345  1.20        pk #define		pmap_protect		pmap_protect4m
    346  1.20        pk #define		pmap_changeprot		pmap_changeprot4m
    347  1.20        pk 
    348  1.20        pk #else  /* must use function pointers */
    349  1.20        pk 
    350  1.41       chs extern boolean_t(*pmap_clear_modify_p) __P((struct vm_page *));
    351  1.41       chs extern boolean_t(*pmap_clear_reference_p) __P((struct vm_page *));
    352  1.43   thorpej extern int	(*pmap_enter_p) __P((pmap_t, vaddr_t, paddr_t, vm_prot_t,
    353  1.43   thorpej 		    int));
    354  1.40   thorpej extern boolean_t (*pmap_extract_p) __P((pmap_t, vaddr_t, paddr_t *));
    355  1.41       chs extern boolean_t(*pmap_is_modified_p) __P((struct vm_page *));
    356  1.41       chs extern boolean_t(*pmap_is_referenced_p) __P((struct vm_page *));
    357  1.41       chs extern void	(*pmap_kenter_pa_p) __P((vaddr_t, paddr_t, vm_prot_t));
    358  1.41       chs extern void	(*pmap_kremove_p) __P((vaddr_t, vsize_t));
    359  1.41       chs extern void	(*pmap_page_protect_p) __P((struct vm_page *, vm_prot_t));
    360  1.34        pk extern void	(*pmap_protect_p) __P((pmap_t, vaddr_t, vaddr_t, vm_prot_t));
    361  1.34        pk extern void	(*pmap_changeprot_p) __P((pmap_t, vaddr_t, vm_prot_t, int));
    362  1.20        pk 
    363  1.34        pk #define		pmap_clear_modify	(*pmap_clear_modify_p)
    364  1.20        pk #define		pmap_clear_reference	(*pmap_clear_reference_p)
    365  1.20        pk #define		pmap_enter		(*pmap_enter_p)
    366  1.20        pk #define		pmap_extract		(*pmap_extract_p)
    367  1.20        pk #define		pmap_is_modified	(*pmap_is_modified_p)
    368  1.20        pk #define		pmap_is_referenced	(*pmap_is_referenced_p)
    369  1.41       chs #define		pmap_kenter_pa		(*pmap_kenter_pa_p)
    370  1.41       chs #define		pmap_kremove		(*pmap_kremove_p)
    371  1.20        pk #define		pmap_page_protect	(*pmap_page_protect_p)
    372  1.20        pk #define		pmap_protect		(*pmap_protect_p)
    373  1.20        pk #define		pmap_changeprot		(*pmap_changeprot_p)
    374  1.20        pk 
    375  1.20        pk #endif
    376  1.45        pk 
    377  1.45        pk /* pmap_{zero,copy}_page() may be assisted by specialized hardware */
    378  1.45        pk #define		pmap_zero_page		(*cpuinfo.zero_page)
    379  1.45        pk #define		pmap_copy_page		(*cpuinfo.copy_page)
    380  1.57       mrg 
    381  1.60   thorpej #if defined(SUN4M) || defined(SUN4D)
    382  1.57       mrg /*
    383  1.57       mrg  * Macros which implement SRMMU TLB flushing/invalidation
    384  1.57       mrg  */
    385  1.57       mrg #define tlb_flush_page_real(va)    \
    386  1.57       mrg 	sta(((vaddr_t)(va) & ~0xfff) | ASI_SRMMUFP_L3, ASI_SRMMUFP, 0)
    387  1.57       mrg 
    388  1.57       mrg #define tlb_flush_segment_real(vr, vs) \
    389  1.57       mrg 	sta(((vr)<<RGSHIFT) | ((vs)<<SGSHIFT) | ASI_SRMMUFP_L2, ASI_SRMMUFP,0)
    390  1.57       mrg 
    391  1.57       mrg #define tlb_flush_region_real(vr) \
    392  1.57       mrg 	sta(((vr) << RGSHIFT) | ASI_SRMMUFP_L1, ASI_SRMMUFP, 0)
    393  1.57       mrg 
    394  1.57       mrg #define tlb_flush_context_real()	sta(ASI_SRMMUFP_L0, ASI_SRMMUFP, 0)
    395  1.57       mrg #define tlb_flush_all_real()		sta(ASI_SRMMUFP_LN, ASI_SRMMUFP, 0)
    396  1.57       mrg 
    397  1.60   thorpej #endif /* SUN4M || SUN4D */
    398   1.7   deraadt 
    399  1.13       jtc #endif /* _KERNEL */
    400   1.1   deraadt 
    401   1.1   deraadt #endif /* _SPARC_PMAP_H_ */
    402