xref: /csrg-svn/sys/hp300/include/pmap.h (revision 52604)
145754Smckusick /*
245754Smckusick  * Copyright (c) 1987 Carnegie-Mellon University
345754Smckusick  * Copyright (c) 1991 Regents of the University of California.
445754Smckusick  * All rights reserved.
545754Smckusick  *
645754Smckusick  * This code is derived from software contributed to Berkeley by
749622Smckusick  * the Systems Programming Group of the University of Utah Computer
849622Smckusick  * Science Department.
945754Smckusick  *
1049631Sbostic  * %sccs.include.redist.c%
1149631Sbostic  *
12*52604Smckusick  *	@(#)pmap.h	7.8 (Berkeley) 02/19/92
1345754Smckusick  */
1445754Smckusick 
1545754Smckusick #ifndef	_PMAP_MACHINE_
1648461Skarels #define	_PMAP_MACHINE_
1745754Smckusick 
1845754Smckusick #define HP_PAGE_SIZE	NBPG
1945754Smckusick #define HP_SEG_SIZE	NBSEG
2045754Smckusick 
2145754Smckusick /*
2245754Smckusick  * Pmap stuff
2345754Smckusick  */
2445754Smckusick struct pmap {
2548461Skarels 	struct pte		*pm_ptab;	/* KVA of page table */
2648461Skarels 	struct ste		*pm_stab;	/* KVA of segment table */
2748461Skarels 	int			pm_stchanged;	/* ST changed */
2845754Smckusick 	short			pm_sref;	/* segment table ref count */
2945754Smckusick 	short			pm_count;	/* pmap reference count */
3045754Smckusick 	simple_lock_data_t	pm_lock;	/* lock on pmap */
3145754Smckusick 	struct pmap_statistics	pm_stats;	/* pmap statistics */
3245754Smckusick 	long			pm_ptpages;	/* more stats: PT pages */
3345754Smckusick };
3445754Smckusick 
3545754Smckusick typedef struct pmap	*pmap_t;
3645754Smckusick 
37*52604Smckusick extern struct pmap	kernel_pmap_store;
38*52604Smckusick #define kernel_pmap (&kernel_pmap_store)
3945754Smckusick 
4045754Smckusick /*
4145754Smckusick  * Macros for speed
4245754Smckusick  */
4348461Skarels #define PMAP_ACTIVATE(pmapp, pcbp, iscurproc) \
4448461Skarels 	if ((pmapp) != NULL && (pmapp)->pm_stchanged) { \
4545754Smckusick 		(pcbp)->pcb_ustp = \
4651578Smckusick 		    hp300_btop(pmap_extract(kernel_pmap, \
4751578Smckusick 			((vm_offset_t)(pmapp)->pm_stab))); \
4848461Skarels 		if (iscurproc) \
4945754Smckusick 			loadustp((pcbp)->pcb_ustp); \
5045754Smckusick 		(pmapp)->pm_stchanged = FALSE; \
5145754Smckusick 	}
5245754Smckusick #define PMAP_DEACTIVATE(pmapp, pcbp)
5345754Smckusick 
5445754Smckusick /*
5545754Smckusick  * For each vm_page_t, there is a list of all currently valid virtual
5645754Smckusick  * mappings of that page.  An entry is a pv_entry_t, the list is pv_table.
5745754Smckusick  */
5845754Smckusick typedef struct pv_entry {
5945754Smckusick 	struct pv_entry	*pv_next;	/* next pv_entry */
6048461Skarels 	struct pmap	*pv_pmap;	/* pmap where mapping lies */
6145754Smckusick 	vm_offset_t	pv_va;		/* virtual address for mapping */
6248461Skarels 	struct ste	*pv_ptste;	/* non-zero if VA maps a PT page */
6348461Skarels 	struct pmap	*pv_ptpmap;	/* if pv_ptste, pmap for PT page */
6445754Smckusick 	int		pv_flags;	/* flags */
6545754Smckusick } *pv_entry_t;
6645754Smckusick 
6745754Smckusick #define	PV_CI		0x01	/* all entries must be cache inhibited */
6845754Smckusick #define PV_PTPAGE	0x02	/* entry maps a page table page */
6945754Smckusick 
7045754Smckusick #ifdef	KERNEL
7145754Smckusick pv_entry_t	pv_table;		/* array of entries, one per page */
7245754Smckusick 
7345754Smckusick #define pa_index(pa)		atop(pa - vm_first_phys)
7445754Smckusick #define pa_to_pvh(pa)		(&pv_table[pa_index(pa)])
7545754Smckusick 
7645754Smckusick #define	pmap_resident_count(pmap)	((pmap)->pm_stats.resident_count)
7745754Smckusick 
7848461Skarels extern	struct pte *Sysmap;
7948461Skarels extern	char *vmmap;			/* map for mem, dumps, etc. */
8045754Smckusick #endif	KERNEL
8145754Smckusick 
8245754Smckusick #endif	_PMAP_MACHINE_
83