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 7*49622Smckusick * the Systems Programming Group of the University of Utah Computer 8*49622Smckusick * Science Department. 945754Smckusick * 10*49622Smckusick * @(#)pmap.h 7.5 (Berkeley) 05/10/91 1145754Smckusick */ 1245754Smckusick 1345754Smckusick #ifndef _PMAP_MACHINE_ 1448461Skarels #define _PMAP_MACHINE_ 1545754Smckusick 1645754Smckusick #define HP_PAGE_SIZE NBPG 1745754Smckusick #define HP_SEG_SIZE NBSEG 1845754Smckusick 1945754Smckusick /* 2045754Smckusick * Pmap stuff 2145754Smckusick */ 2245754Smckusick struct pmap { 2348461Skarels struct pte *pm_ptab; /* KVA of page table */ 2448461Skarels struct ste *pm_stab; /* KVA of segment table */ 2548461Skarels int pm_stchanged; /* ST changed */ 2645754Smckusick short pm_sref; /* segment table ref count */ 2745754Smckusick short pm_count; /* pmap reference count */ 2845754Smckusick simple_lock_data_t pm_lock; /* lock on pmap */ 2945754Smckusick struct pmap_statistics pm_stats; /* pmap statistics */ 3045754Smckusick long pm_ptpages; /* more stats: PT pages */ 3145754Smckusick }; 3245754Smckusick 3345754Smckusick typedef struct pmap *pmap_t; 3445754Smckusick 3545754Smckusick extern pmap_t kernel_pmap; 3645754Smckusick 3745754Smckusick /* 3845754Smckusick * Macros for speed 3945754Smckusick */ 4048461Skarels #define PMAP_ACTIVATE(pmapp, pcbp, iscurproc) \ 4148461Skarels if ((pmapp) != NULL && (pmapp)->pm_stchanged) { \ 4245754Smckusick (pcbp)->pcb_ustp = \ 4345754Smckusick hp300_btop(pmap_extract(kernel_pmap, (pmapp)->pm_stab)); \ 4448461Skarels if (iscurproc) \ 4545754Smckusick loadustp((pcbp)->pcb_ustp); \ 4645754Smckusick (pmapp)->pm_stchanged = FALSE; \ 4745754Smckusick } 4845754Smckusick #define PMAP_DEACTIVATE(pmapp, pcbp) 4945754Smckusick 5045754Smckusick /* 5145754Smckusick * For each vm_page_t, there is a list of all currently valid virtual 5245754Smckusick * mappings of that page. An entry is a pv_entry_t, the list is pv_table. 5345754Smckusick */ 5445754Smckusick typedef struct pv_entry { 5545754Smckusick struct pv_entry *pv_next; /* next pv_entry */ 5648461Skarels struct pmap *pv_pmap; /* pmap where mapping lies */ 5745754Smckusick vm_offset_t pv_va; /* virtual address for mapping */ 5848461Skarels struct ste *pv_ptste; /* non-zero if VA maps a PT page */ 5948461Skarels struct pmap *pv_ptpmap; /* if pv_ptste, pmap for PT page */ 6045754Smckusick int pv_flags; /* flags */ 6145754Smckusick } *pv_entry_t; 6245754Smckusick 6345754Smckusick #define PV_CI 0x01 /* all entries must be cache inhibited */ 6445754Smckusick #define PV_PTPAGE 0x02 /* entry maps a page table page */ 6545754Smckusick 6645754Smckusick #ifdef KERNEL 6745754Smckusick pv_entry_t pv_table; /* array of entries, one per page */ 6845754Smckusick 6945754Smckusick #define pa_index(pa) atop(pa - vm_first_phys) 7045754Smckusick #define pa_to_pvh(pa) (&pv_table[pa_index(pa)]) 7145754Smckusick 7249331Shibler #define pmap_kernel() (kernel_pmap) 7345754Smckusick #define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count) 7445754Smckusick 7548461Skarels extern struct pte *Sysmap; 7648461Skarels extern char *vmmap; /* map for mem, dumps, etc. */ 7745754Smckusick #endif KERNEL 7845754Smckusick 7945754Smckusick #endif _PMAP_MACHINE_ 80