[BACK]Return to pmap.h CVS log [TXT][DIR] Up to [local] / sys / arch / sh / include

Annotation of sys/arch/sh/include/pmap.h, Revision 1.1

1.1     ! nbrk        1: /*     $OpenBSD: pmap.h,v 1.2 2007/03/05 21:48:21 miod Exp $   */
        !             2: /*     $NetBSD: pmap.h,v 1.28 2006/04/10 23:12:11 uwe Exp $    */
        !             3:
        !             4: /*-
        !             5:  * Copyright (c) 2002 The NetBSD Foundation, Inc.
        !             6:  * All rights reserved.
        !             7:  *
        !             8:  * This code is derived from software contributed to The NetBSD Foundation
        !             9:  * by UCHIYAMA Yasushi.
        !            10:  *
        !            11:  * Redistribution and use in source and binary forms, with or without
        !            12:  * modification, are permitted provided that the following conditions
        !            13:  * are met:
        !            14:  * 1. Redistributions of source code must retain the above copyright
        !            15:  *    notice, this list of conditions and the following disclaimer.
        !            16:  * 2. Redistributions in binary form must reproduce the above copyright
        !            17:  *    notice, this list of conditions and the following disclaimer in the
        !            18:  *    documentation and/or other materials provided with the distribution.
        !            19:  * 3. All advertising materials mentioning features or use of this software
        !            20:  *    must display the following acknowledgement:
        !            21:  *        This product includes software developed by the NetBSD
        !            22:  *        Foundation, Inc. and its contributors.
        !            23:  * 4. Neither the name of The NetBSD Foundation nor the names of its
        !            24:  *    contributors may be used to endorse or promote products derived
        !            25:  *    from this software without specific prior written permission.
        !            26:  *
        !            27:  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
        !            28:  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
        !            29:  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
        !            30:  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
        !            31:  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
        !            32:  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
        !            33:  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
        !            34:  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
        !            35:  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
        !            36:  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
        !            37:  * POSSIBILITY OF SUCH DAMAGE.
        !            38:  */
        !            39:
        !            40: /*
        !            41:  * OpenBSD/sh pmap:
        !            42:  *     pmap.pm_ptp[512] ... 512 slot of page table page
        !            43:  *     page table page contains 1024 PTEs. (PAGE_SIZE / sizeof(pt_entry_t))
        !            44:  *       | PTP 11bit | PTOFSET 10bit | PGOFSET 12bit |
        !            45:  */
        !            46:
        !            47: #ifndef _SH_PMAP_H_
        !            48: #define        _SH_PMAP_H_
        !            49: #include <sys/queue.h>
        !            50: #include <sh/pte.h>
        !            51:
        !            52: #define        PMAP_STEAL_MEMORY
        !            53: #define        PMAP_GROWKERNEL
        !            54:
        !            55: #define        __PMAP_PTP_N    512     /* # of page table page maps 2GB. */
        !            56: typedef struct pmap {
        !            57:        pt_entry_t **pm_ptp;
        !            58:        int pm_asid;
        !            59:        int pm_refcnt;
        !            60:        struct pmap_statistics  pm_stats;       /* pmap statistics */
        !            61: } *pmap_t;
        !            62: extern struct pmap __pmap_kernel;
        !            63:
        !            64: void pmap_bootstrap(void);
        !            65: void pmap_proc_iflush(struct proc *, vaddr_t, size_t);
        !            66: #define        pmap_unuse_final(p)             do { /* nothing */ } while (0)
        !            67: #define        pmap_kernel()                   (&__pmap_kernel)
        !            68: #define        pmap_deactivate(pmap)           do { /* nothing */ } while (0)
        !            69: #define        pmap_update(pmap)               do { /* nothing */ } while (0)
        !            70: #define        pmap_copy(dp,sp,d,l,s)          do { /* nothing */ } while (0)
        !            71: #define        pmap_collect(pmap)              do { /* nothing */ } while (0)
        !            72: #define        pmap_wired_count(pmap)          ((pmap)->pm_stats.wired_count)
        !            73: #define        pmap_resident_count(pmap)       ((pmap)->pm_stats.resident_count)
        !            74: #define        pmap_phys_address(frame)        ((paddr_t)(ptoa(frame)))
        !            75:
        !            76: /* ARGSUSED */
        !            77: static __inline void
        !            78: pmap_remove_all(struct pmap *pmap)
        !            79: {
        !            80:        /* Nothing. */
        !            81: }
        !            82:
        !            83: /*
        !            84:  * pmap_prefer() helps to avoid virtual cache aliases on SH4 CPUs
        !            85:  * which have the virtually-indexed cache.
        !            86:  */
        !            87: #ifdef SH4
        !            88: #define        PMAP_PREFER(pa, va)             pmap_prefer((pa), (va))
        !            89: void pmap_prefer(vaddr_t, vaddr_t *);
        !            90: #endif /* SH4 */
        !            91:
        !            92: #define        __HAVE_PMAP_DIRECT
        !            93: #define        pmap_map_direct(pg)             SH3_PHYS_TO_P1SEG(VM_PAGE_TO_PHYS(pg))
        !            94: #define        pmap_unmap_direct(va)           PHYS_TO_VM_PAGE(SH3_P1SEG_TO_PHYS((va)))
        !            95:
        !            96: /* MD pmap utils. */
        !            97: pt_entry_t *__pmap_pte_lookup(pmap_t, vaddr_t);
        !            98: pt_entry_t *__pmap_kpte_lookup(vaddr_t);
        !            99: boolean_t __pmap_pte_load(pmap_t, vaddr_t, int);
        !           100: #endif /* !_SH_PMAP_H_ */

CVSweb