Annotation of sys/arch/solbourne/include/pmap.h, Revision 1.1
1.1 ! nbrk 1: /* $OpenBSD: pmap.h,v 1.1 2005/04/19 21:30:18 miod Exp $ */
! 2: /*
! 3: * Copyright (c) 2005, Miodrag Vallat
! 4: *
! 5: * Redistribution and use in source and binary forms, with or without
! 6: * modification, are permitted provided that the following conditions
! 7: * are met:
! 8: * 1. Redistributions of source code must retain the above copyright
! 9: * notice, this list of conditions and the following disclaimer.
! 10: * 2. Redistributions in binary form must reproduce the above copyright
! 11: * notice, this list of conditions and the following disclaimer in the
! 12: * documentation and/or other materials provided with the distribution.
! 13: *
! 14: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
! 15: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
! 16: * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
! 17: * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
! 18: * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
! 19: * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
! 20: * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
! 21: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
! 22: * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
! 23: * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! 24: * POSSIBILITY OF SUCH DAMAGE.
! 25: */
! 26:
! 27: #ifndef _SOLBOURNE_PMAP_H_
! 28: #define _SOLBOURNE_PMAP_H_
! 29:
! 30: #include <machine/pte.h>
! 31:
! 32: /*
! 33: * PMAP structure
! 34: */
! 35: struct pmap {
! 36: pd_entry_t *pm_segtab; /* first level table */
! 37: paddr_t pm_psegtab; /* pa of above */
! 38:
! 39: int pm_refcount; /* reference count */
! 40: struct simplelock pm_lock;
! 41: struct pmap_statistics pm_stats; /* pmap statistics */
! 42: };
! 43:
! 44: typedef struct pmap *pmap_t;
! 45:
! 46: /*
! 47: * Extra constants passed in the low bits of pa in pmap_enter() to
! 48: * request specific memory attributes.
! 49: */
! 50:
! 51: #define PMAP_NC 1
! 52: #define PMAP_OBIO PMAP_NC
! 53: #define PMAP_BWS 2
! 54:
! 55: /*
! 56: * Macro to pass iospace bits in the low bits of pa in pmap_enter().
! 57: * Provided for source code compatibility - we don't need such bits.
! 58: */
! 59:
! 60: #define PMAP_IOENC(x) 0
! 61:
! 62: #ifdef _KERNEL
! 63:
! 64: extern struct pmap kernel_pmap_store;
! 65:
! 66: #define kvm_recache(addr, npages) kvm_setcache(addr, npages, 1)
! 67: #define kvm_uncache(addr, npages) kvm_setcache(addr, npages, 0)
! 68: #define pmap_copy(a,b,c,d,e) do { /* nothing */ } while (0)
! 69: #define pmap_deactivate(p) do { /* nothing */ } while (0)
! 70: #define pmap_kernel() (&kernel_pmap_store)
! 71: #define pmap_phys_address(frame) ptoa(frame)
! 72: #define pmap_resident_count(p) ((p)->pm_stats.resident_count)
! 73: #define pmap_update(p) do { /* nothing */ } while (0)
! 74: #define pmap_wired_count(p) ((p)->pm_stats.wired_count)
! 75:
! 76: #define PMAP_PREFER(fo, ap) pmap_prefer((fo), (ap))
! 77:
! 78: struct proc;
! 79: void kvm_setcache(caddr_t, int, int);
! 80: void switchexit(struct proc *); /* locore.s */
! 81: void pmap_activate(struct proc *);
! 82: void pmap_bootstrap(size_t);
! 83: void pmap_cache_enable(void);
! 84: void pmap_changeprot(pmap_t, vaddr_t, vm_prot_t, int);
! 85: boolean_t pmap_clear_modify(struct vm_page *);
! 86: boolean_t pmap_clear_reference(struct vm_page *);
! 87: void pmap_copy_page(struct vm_page *, struct vm_page *);
! 88: pmap_t pmap_create(void);
! 89: void pmap_destroy(pmap_t);
! 90: int pmap_enter(pmap_t, vaddr_t, paddr_t, vm_prot_t, int);
! 91: boolean_t pmap_extract(pmap_t, vaddr_t, paddr_t *);
! 92: void pmap_init(void);
! 93: boolean_t pmap_is_modified(struct vm_page *);
! 94: boolean_t pmap_is_referenced(struct vm_page *);
! 95: void pmap_kenter_pa(vaddr_t, paddr_t, vm_prot_t);
! 96: void pmap_kremove(vaddr_t, vsize_t);
! 97: vaddr_t pmap_map(vaddr_t, paddr_t, paddr_t, int);
! 98: int pmap_pa_exists(paddr_t);
! 99: void pmap_page_protect(struct vm_page *, vm_prot_t);
! 100: void pmap_prefer(vaddr_t, vaddr_t *);
! 101: void pmap_proc_iflush(struct proc *, vaddr_t, vsize_t);
! 102: void pmap_protect(pmap_t, vaddr_t, vaddr_t, vm_prot_t);
! 103: void pmap_reference(pmap_t);
! 104: void pmap_release(pmap_t);
! 105: void pmap_redzone(void);
! 106: void pmap_remove(pmap_t, vaddr_t, vaddr_t);
! 107: void pmap_unwire(pmap_t, vaddr_t);
! 108: void pmap_virtual_space(vaddr_t *, vaddr_t *);
! 109: void pmap_writetext(unsigned char *, int);
! 110: void pmap_zero_page(struct vm_page *);
! 111:
! 112: #endif /* _KERNEL */
! 113:
! 114: #endif /* _SOLBOURNE_PMAP_H_ */
CVSweb