* Copyright (c) 1988 University of Utah.
* Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* Redistribution is only permitted until one year after the first shipment
* of 4.4BSD by the Regents. Otherwise, redistribution and use in source and
* binary forms are permitted provided that: (1) source distributions retain
* this entire copyright notice and comment, and (2) distributions including
* binaries display the following acknowledgement: This product includes
* software developed by the University of California, Berkeley and its
* contributors'' in the documentation or other materials provided with the
* distribution and in all advertising materials mentioning features or use
* of this software. Neither the name of the University nor the names of
* its contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
* from: Utah $Hdr: pte.h 1.11 89/09/03$
* @(#)pte.h 7.1 (Berkeley) 5/8/90
* There are two major kinds of pte's: those which have ever existed (and are
* thus either now in core or on the swap device), and those which have
* never existed, but which will be filled on demand at first reference.
* There is a structure describing each. There is also an ancillary
* structure used in page clustering.
unsigned int sg_pfnum
:20, /* page table frame number */
sg_prot
:1, /* write protect bit */
unsigned int pg_pfnum
:20, /* page frame number or 0 */
pg_fod
:1, /* is fill on demand (=0) */
:1, /* reserved at zero */
pg_ci
:1, /* cache inhibit bit */
:1, /* reserved at zero */
pg_m
:1, /* hardware modified (dirty) bit */
pg_u
:1, /* hardware used (reference) bit */
pg_prot
:1, /* write protect bit */
unsigned int pg_pfnum
:20,
pg_high
:12; /* special for clustering */
unsigned int pg_blkno
:22, /* file system block number */
pg_fileno
:1, /* file mapped from or TEXT or ZERO */
pg_fod
:1, /* is fill on demand (=1) */
#define SG_PROT 0x00000004
#define SG_FRAME 0xfffff000
#define SG_IMASK 0xffc00000
#define SG_PMASK 0x003ff000
#define PG_PROT 0x00000004
#define PG_FOD 0x00000100
#define PG_FRAME 0xfffff000
#define PG_PFNUM(x) (((x) & PG_FRAME) >> PGSHIFT)
* Note that PG_URKW is not defined intuitively, but it is currently only
* used in vgetu() to initialize the u-area PTEs in the process address
* space. Since the kernel never accesses the u-area thru these we are ok.
#define PG_FMAX (PG_FTEXT)
#define dirty(pte) ((pte)->pg_m)
* Kernel virtual address to page table entry and to physical address.
#define kvtopte(va) (&Sysmap[((unsigned)(va) &~ KERNBASE) >> PGSHIFT])
#define ptetokv(pt) ((((struct pte *)(pt) - Sysmap) << PGSHIFT) | KERNBASE)
#define kvtophys(x) ((kvtopte(x)->pg_pfnum << PGSHIFT) | ((int)(x) & PGOFSET))
#if defined(KERNEL) && !defined(LOCORE)
/* utilities defined in locore.s */
extern struct pte Sysmap
[];
extern struct pte Usrptmap
[];
extern struct pte usrpt
[];
extern struct pte Swapmap
[];
extern struct pte Forkmap
[];
extern struct pte Xswapmap
[];
extern struct pte Xswap2map
[];
extern struct pte Pushmap
[];
extern struct pte Vfmap
[];
extern struct pte mmap
[];
extern struct pte msgbufmap
[];
extern struct pte kmempt
[], ekmempt
[];
extern struct ste Sysseg
[];
#endif /* defined(KERNEL) && !defined(LOCORE) */