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

Annotation of sys/arch/vax/include/pte.h, Revision 1.1.1.1

1.1       nbrk        1: /*      $OpenBSD: pte.h,v 1.10 2006/07/25 21:05:31 miod Exp $      */
                      2: /*     $NetBSD: pte.h,v 1.21 2005/12/24 22:45:40 perry Exp $     */
                      3:
                      4: /*
                      5:  * Copyright (c) 1994 Ludd, University of Lule}, Sweden.
                      6:  * All rights reserved.
                      7:  *
                      8:  * Redistribution and use in source and binary forms, with or without
                      9:  * modification, are permitted provided that the following conditions
                     10:  * are met:
                     11:  * 1. Redistributions of source code must retain the above copyright
                     12:  *    notice, this list of conditions and the following disclaimer.
                     13:  * 2. Redistributions in binary form must reproduce the above copyright
                     14:  *    notice, this list of conditions and the following disclaimer in the
                     15:  *    documentation and/or other materials provided with the distribution.
                     16:  * 3. All advertising materials mentioning features or use of this software
                     17:  *    must display the following acknowledgement:
                     18:  *     This product includes software developed at Ludd, University of Lule}.
                     19:  * 4. The name of the author may not be used to endorse or promote products
                     20:  *    derived from this software without specific prior written permission
                     21:  *
                     22:  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
                     23:  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
                     24:  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
                     25:  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
                     26:  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
                     27:  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
                     28:  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
                     29:  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
                     30:  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
                     31:  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
                     32:  */
                     33:
                     34: #ifndef _VAX_PTE_H_
                     35: #define _VAX_PTE_H_
                     36:
                     37: #ifndef _LOCORE
                     38:
                     39: typedef u_int32_t      pt_entry_t;     /* Mach page table entry */
                     40:
                     41: #endif /* _LOCORE */
                     42:
                     43: #define        PT_ENTRY_NULL   ((pt_entry_t *) 0)
                     44:
                     45: #define        PG_V            0x80000000
                     46: #define        PG_NV           0x00000000
                     47: #define        PG_PROT         0x78000000
                     48: #define        PG_RW           0x20000000
                     49: #define        PG_KW           0x10000000
                     50: #define        PG_KR           0x18000000
                     51: #define        PG_URKW         0x70000000
                     52: #define        PG_RO           0x78000000
                     53: #define        PG_NONE         0x00000000
                     54: #define        PG_M            0x04000000
                     55: #define        PG_W            0x01000000
                     56: #define        PG_SREF         0x00800000
                     57: #define        PG_ILLEGAL      0x00600000
                     58: #define        PG_FRAME        0x001fffff
                     59: #define        PG_PFNUM(x)     (((unsigned long)(x) & 0x3ffffe00) >> VAX_PGSHIFT)
                     60:
                     61: #ifndef _LOCORE
                     62: extern pt_entry_t *Sysmap;
                     63: /*
                     64:  * Kernel virtual address to page table entry and to physical address.
                     65:  */
                     66: #endif
                     67:
                     68: #ifdef __ELF__
                     69: #define VAX_SYSMAP     "Sysmap"
                     70: #else
                     71: #define VAX_SYSMAP     "_Sysmap"
                     72: #endif
                     73:
                     74: #ifdef __GNUC__
                     75: #define kvtopte(va) ({ \
                     76:        pt_entry_t *r; \
                     77:        __asm("extzv $9,$21,%1,%0;moval *" VAX_SYSMAP "[%0],%0" : "=r"(r) : "g"(va)); \
                     78:        r; \
                     79: })
                     80: #define kvtophys(va) ({ \
                     81:        paddr_t r; \
                     82:        __asm("extzv $9,$21,%1,%0;ashl $9,*" VAX_SYSMAP "[%0],%0;insv %1,$0,$9,%0" \
                     83:            : "=&r"(r) : "g"(va) : "cc"); \
                     84:        r; \
                     85: })
                     86: #else /* __GNUC__ */
                     87: #define kvtopte(va) (&Sysmap[PG_PFNUM(va)])
                     88: #define kvtophys(va) \
                     89:        (((*kvtopte(va) & PG_FRAME) << VAX_PGSHIFT) | ((int)(va) & VAX_PGOFSET))
                     90: #endif /* __GNUC__ */
                     91: #define uvtopte(va, pcb) \
                     92:        (((vaddr_t)(va) < 0x40000000) ? \
                     93:        &(((pcb)->P0BR)[PG_PFNUM(va)]) : \
                     94:        &(((pcb)->P1BR)[PG_PFNUM(va)]))
                     95:
                     96: #endif

CVSweb