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*51578Smckusick * @(#)pmap.h 7.7 (Berkeley) 11/05/91 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 3745754Smckusick extern pmap_t kernel_pmap; 3845754Smckusick 3945754Smckusick /* 4045754Smckusick * Macros for speed 4145754Smckusick */ 4248461Skarels #define PMAP_ACTIVATE(pmapp, pcbp, iscurproc) \ 4348461Skarels if ((pmapp) != NULL && (pmapp)->pm_stchanged) { \ 4445754Smckusick (pcbp)->pcb_ustp = \ 45*51578Smckusick hp300_btop(pmap_extract(kernel_pmap, \ 46*51578Smckusick ((vm_offset_t)(pmapp)->pm_stab))); \ 4748461Skarels if (iscurproc) \ 4845754Smckusick loadustp((pcbp)->pcb_ustp); \ 4945754Smckusick (pmapp)->pm_stchanged = FALSE; \ 5045754Smckusick } 5145754Smckusick #define PMAP_DEACTIVATE(pmapp, pcbp) 5245754Smckusick 5345754Smckusick /* 5445754Smckusick * For each vm_page_t, there is a list of all currently valid virtual 5545754Smckusick * mappings of that page. An entry is a pv_entry_t, the list is pv_table. 5645754Smckusick */ 5745754Smckusick typedef struct pv_entry { 5845754Smckusick struct pv_entry *pv_next; /* next pv_entry */ 5948461Skarels struct pmap *pv_pmap; /* pmap where mapping lies */ 6045754Smckusick vm_offset_t pv_va; /* virtual address for mapping */ 6148461Skarels struct ste *pv_ptste; /* non-zero if VA maps a PT page */ 6248461Skarels struct pmap *pv_ptpmap; /* if pv_ptste, pmap for PT page */ 6345754Smckusick int pv_flags; /* flags */ 6445754Smckusick } *pv_entry_t; 6545754Smckusick 6645754Smckusick #define PV_CI 0x01 /* all entries must be cache inhibited */ 6745754Smckusick #define PV_PTPAGE 0x02 /* entry maps a page table page */ 6845754Smckusick 6945754Smckusick #ifdef KERNEL 7045754Smckusick pv_entry_t pv_table; /* array of entries, one per page */ 7145754Smckusick 7245754Smckusick #define pa_index(pa) atop(pa - vm_first_phys) 7345754Smckusick #define pa_to_pvh(pa) (&pv_table[pa_index(pa)]) 7445754Smckusick 7549331Shibler #define pmap_kernel() (kernel_pmap) 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