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 745754Smckusick * The Mach Operating System project at Carnegie-Mellon University. 845754Smckusick * 945754Smckusick * The CMU software License Agreement specifies the terms and conditions 1045754Smckusick * for use and redistribution. 1145754Smckusick * 12*49331Shibler * @(#)pmap.h 7.4 (Berkeley) 05/07/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 = \ 4545754Smckusick hp300_btop(pmap_extract(kernel_pmap, (pmapp)->pm_stab)); \ 4648461Skarels if (iscurproc) \ 4745754Smckusick loadustp((pcbp)->pcb_ustp); \ 4845754Smckusick (pmapp)->pm_stchanged = FALSE; \ 4945754Smckusick } 5045754Smckusick #define PMAP_DEACTIVATE(pmapp, pcbp) 5145754Smckusick 5245754Smckusick /* 5345754Smckusick * For each vm_page_t, there is a list of all currently valid virtual 5445754Smckusick * mappings of that page. An entry is a pv_entry_t, the list is pv_table. 5545754Smckusick */ 5645754Smckusick typedef struct pv_entry { 5745754Smckusick struct pv_entry *pv_next; /* next pv_entry */ 5848461Skarels struct pmap *pv_pmap; /* pmap where mapping lies */ 5945754Smckusick vm_offset_t pv_va; /* virtual address for mapping */ 6048461Skarels struct ste *pv_ptste; /* non-zero if VA maps a PT page */ 6148461Skarels struct pmap *pv_ptpmap; /* if pv_ptste, pmap for PT page */ 6245754Smckusick int pv_flags; /* flags */ 6345754Smckusick } *pv_entry_t; 6445754Smckusick 6545754Smckusick #define PV_CI 0x01 /* all entries must be cache inhibited */ 6645754Smckusick #define PV_PTPAGE 0x02 /* entry maps a page table page */ 6745754Smckusick 6845754Smckusick #ifdef KERNEL 6945754Smckusick pv_entry_t pv_table; /* array of entries, one per page */ 7045754Smckusick 7145754Smckusick #define pa_index(pa) atop(pa - vm_first_phys) 7245754Smckusick #define pa_to_pvh(pa) (&pv_table[pa_index(pa)]) 7345754Smckusick 74*49331Shibler #define pmap_kernel() (kernel_pmap) 7545754Smckusick #define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count) 7645754Smckusick 7748461Skarels extern struct pte *Sysmap; 7848461Skarels extern char *vmmap; /* map for mem, dumps, etc. */ 7945754Smckusick #endif KERNEL 8045754Smckusick 8145754Smckusick #endif _PMAP_MACHINE_ 82