Annotation of sys/arch/m68k/include/pmap_motorola.h, Revision 1.1
1.1 ! nbrk 1: /* $OpenBSD: pmap_motorola.h,v 1.15 2006/06/24 13:22:14 miod Exp $ */
! 2:
! 3: /*
! 4: * Copyright (c) 1987 Carnegie-Mellon University
! 5: * Copyright (c) 1991, 1993
! 6: * The Regents of the University of California. All rights reserved.
! 7: *
! 8: * This code is derived from software contributed to Berkeley by
! 9: * the Systems Programming Group of the University of Utah Computer
! 10: * Science Department.
! 11: *
! 12: * Redistribution and use in source and binary forms, with or without
! 13: * modification, are permitted provided that the following conditions
! 14: * are met:
! 15: * 1. Redistributions of source code must retain the above copyright
! 16: * notice, this list of conditions and the following disclaimer.
! 17: * 2. Redistributions in binary form must reproduce the above copyright
! 18: * notice, this list of conditions and the following disclaimer in the
! 19: * documentation and/or other materials provided with the distribution.
! 20: * 3. Neither the name of the University nor the names of its contributors
! 21: * may be used to endorse or promote products derived from this software
! 22: * without specific prior written permission.
! 23: *
! 24: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
! 25: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
! 26: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
! 27: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
! 28: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
! 29: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
! 30: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
! 31: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
! 32: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
! 33: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
! 34: * SUCH DAMAGE.
! 35: *
! 36: * @(#)pmap.h 8.1 (Berkeley) 6/10/93
! 37: */
! 38:
! 39: #ifndef _PMAP_MOTOROLA_H_
! 40: #define _PMAP_MOTOROLA_H_
! 41:
! 42: #include <machine/cpu.h>
! 43: #include <machine/pte.h>
! 44:
! 45: /*
! 46: * Pmap stuff
! 47: */
! 48: struct pmap {
! 49: pt_entry_t *pm_ptab; /* KVA of page table */
! 50: st_entry_t *pm_stab; /* KVA of segment table */
! 51: int pm_stfree; /* 040: free lev2 blocks */
! 52: st_entry_t *pm_stpa; /* 040: ST phys addr */
! 53: short pm_sref; /* segment table ref count */
! 54: short pm_count; /* pmap reference count */
! 55: struct simplelock pm_lock; /* lock on pmap */
! 56: struct pmap_statistics pm_stats; /* pmap statistics */
! 57: long pm_ptpages; /* more stats: PT pages */
! 58: };
! 59:
! 60: typedef struct pmap *pmap_t;
! 61:
! 62: /*
! 63: * On the 040 we keep track of which level 2 blocks are already in use
! 64: * with the pm_stfree mask. Bits are arranged from LSB (block 0) to MSB
! 65: * (block 31). For convenience, the level 1 table is considered to be
! 66: * block 0.
! 67: *
! 68: * MAX[KU]L2SIZE control how many pages of level 2 descriptors are allowed.
! 69: * for the kernel and users. 8 implies only the initial "segment table"
! 70: * page is used. WARNING: don't change MAXUL2SIZE unless you can allocate
! 71: * physically contiguous pages for the ST in pmap.c!
! 72: */
! 73: #define MAXKL2SIZE 32
! 74: #define MAXUL2SIZE 8
! 75: #define l2tobm(n) (1 << (n))
! 76: #define bmtol2(n) (ffs(n) - 1)
! 77:
! 78: /*
! 79: * Macros for speed
! 80: */
! 81: #define PMAP_ACTIVATE(pmap, loadhw) \
! 82: { \
! 83: if ((loadhw)) \
! 84: loadustp(atop((paddr_t)(pmap)->pm_stpa)); \
! 85: }
! 86:
! 87: /* XXX - struct pv_entry moved to vmparam.h because of include ordering issues */
! 88:
! 89: struct pv_page;
! 90:
! 91: struct pv_page_info {
! 92: TAILQ_ENTRY(pv_page) pgi_list;
! 93: struct pv_entry *pgi_freelist;
! 94: int pgi_nfree;
! 95: };
! 96:
! 97: /*
! 98: * This is basically:
! 99: * ((PAGE_SIZE - sizeof(struct pv_page_info)) / sizeof(struct pv_entry))
! 100: */
! 101: #if PAGE_SHIFT == 13
! 102: #define NPVPPG 340
! 103: #elif PAGE_SHIFT == 12
! 104: #define NPVPPG 170
! 105: #endif
! 106:
! 107: struct pv_page {
! 108: struct pv_page_info pvp_pgi;
! 109: struct pv_entry pvp_pv[NPVPPG];
! 110: };
! 111:
! 112: #ifdef _KERNEL
! 113:
! 114: extern struct pmap kernel_pmap_store;
! 115:
! 116: #define pmap_kernel() (&kernel_pmap_store)
! 117: #define active_pmap(pm) \
! 118: ((pm) == pmap_kernel() || (pm) == curproc->p_vmspace->vm_map.pmap)
! 119: #define active_user_pmap(pm) \
! 120: (curproc && \
! 121: (pm) != pmap_kernel() && (pm) == curproc->p_vmspace->vm_map.pmap)
! 122:
! 123: extern struct pv_entry *pv_table; /* array of entries, one per page */
! 124:
! 125: #define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count)
! 126: #define pmap_wired_count(pmap) ((pmap)->pm_stats.wired_count)
! 127: #define pmap_phys_address(frame) ((paddr_t)ptoa(frame))
! 128:
! 129: #define pmap_copy(dp,sp,d,l,s) do { /* nothing */ } while (0)
! 130: #define pmap_update(pmap) do { /* nothing (yet) */ } while (0)
! 131: #define pmap_unuse_final(p) do { /* nothing */ } while (0)
! 132:
! 133: extern pt_entry_t *Sysmap;
! 134: extern char *vmmap; /* map for mem, dumps, etc. */
! 135:
! 136: void pmap_proc_iflush(struct proc *, vaddr_t, vsize_t);
! 137:
! 138: int pmap_enter_cache(pmap_t, vaddr_t, paddr_t, vm_prot_t, int, pt_entry_t);
! 139: void pmap_kenter_cache(vaddr_t, paddr_t, pt_entry_t);
! 140:
! 141: #ifdef M68K_MMU_HP
! 142: void pmap_prefer(vaddr_t, vaddr_t *);
! 143: #define PMAP_PREFER(foff, vap) pmap_prefer((foff), (vap))
! 144: #endif
! 145:
! 146: #ifdef COMPAT_HPUX
! 147: int pmap_mapmulti(pmap_t, vaddr_t);
! 148: #endif
! 149:
! 150: #endif /* _KERNEL */
! 151:
! 152: #endif /* !_PMAP_MOTOROLA_H_ */
CVSweb