reorganization to move ufsmount ops to be vnode ops;
[unix-history] / usr / src / sys / hp300 / include / pmap.h
CommitLineData
8f961915
KM
1/*
2 * Copyright (c) 1987 Carnegie-Mellon University
3 * Copyright (c) 1991 Regents of the University of California.
4 * All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
4a4de5a4
KM
7 * the Systems Programming Group of the University of Utah Computer
8 * Science Department.
8f961915 9 *
08693cad
KB
10 * %sccs.include.redist.c%
11 *
12 * @(#)pmap.h 7.6 (Berkeley) %G%
8f961915
KM
13 */
14
15#ifndef _PMAP_MACHINE_
0390aac7 16#define _PMAP_MACHINE_
8f961915
KM
17
18#define HP_PAGE_SIZE NBPG
19#define HP_SEG_SIZE NBSEG
20
8f961915
KM
21/*
22 * Pmap stuff
23 */
8f961915 24struct pmap {
0390aac7
MK
25 struct pte *pm_ptab; /* KVA of page table */
26 struct ste *pm_stab; /* KVA of segment table */
27 int pm_stchanged; /* ST changed */
8f961915
KM
28 short pm_sref; /* segment table ref count */
29 short pm_count; /* pmap reference count */
30 simple_lock_data_t pm_lock; /* lock on pmap */
31 struct pmap_statistics pm_stats; /* pmap statistics */
32 long pm_ptpages; /* more stats: PT pages */
33};
34
35typedef struct pmap *pmap_t;
36
37extern pmap_t kernel_pmap;
38
39/*
40 * Macros for speed
41 */
0390aac7
MK
42#define PMAP_ACTIVATE(pmapp, pcbp, iscurproc) \
43 if ((pmapp) != NULL && (pmapp)->pm_stchanged) { \
8f961915
KM
44 (pcbp)->pcb_ustp = \
45 hp300_btop(pmap_extract(kernel_pmap, (pmapp)->pm_stab)); \
0390aac7 46 if (iscurproc) \
8f961915
KM
47 loadustp((pcbp)->pcb_ustp); \
48 (pmapp)->pm_stchanged = FALSE; \
49 }
50#define PMAP_DEACTIVATE(pmapp, pcbp)
51
52/*
53 * For each vm_page_t, there is a list of all currently valid virtual
54 * mappings of that page. An entry is a pv_entry_t, the list is pv_table.
55 */
56typedef struct pv_entry {
57 struct pv_entry *pv_next; /* next pv_entry */
0390aac7 58 struct pmap *pv_pmap; /* pmap where mapping lies */
8f961915 59 vm_offset_t pv_va; /* virtual address for mapping */
0390aac7
MK
60 struct ste *pv_ptste; /* non-zero if VA maps a PT page */
61 struct pmap *pv_ptpmap; /* if pv_ptste, pmap for PT page */
8f961915
KM
62 int pv_flags; /* flags */
63} *pv_entry_t;
64
8f961915
KM
65#define PV_CI 0x01 /* all entries must be cache inhibited */
66#define PV_PTPAGE 0x02 /* entry maps a page table page */
67
68#ifdef KERNEL
8f961915
KM
69pv_entry_t pv_table; /* array of entries, one per page */
70
71#define pa_index(pa) atop(pa - vm_first_phys)
72#define pa_to_pvh(pa) (&pv_table[pa_index(pa)])
73
9686a6fc 74#define pmap_kernel() (kernel_pmap)
8f961915
KM
75#define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count)
76
0390aac7
MK
77extern struct pte *Sysmap;
78extern char *vmmap; /* map for mem, dumps, etc. */
8f961915
KM
79#endif KERNEL
80
81#endif _PMAP_MACHINE_