134408Skarels /* 234408Skarels * Copyright (c) 1988 Regents of the University of California. 334408Skarels * All rights reserved. The Berkeley software License Agreement 434408Skarels * specifies the terms and conditions for redistribution. 534408Skarels * 6*37749Smckusick * @(#)pte.h 7.2 (Berkeley) 05/09/89 734408Skarels */ 824005Ssam 924005Ssam /* 1024005Ssam * Tahoe page table entry 1124005Ssam * 1224005Ssam * There are two major kinds of pte's: those which have ever existed (and are 1324005Ssam * thus either now in core or on the swap device), and those which have 1424005Ssam * never existed, but which will be filled on demand at first reference. 1524005Ssam * There is a structure describing each. There is also an ancillary 1624005Ssam * structure used in page clustering. 1724005Ssam */ 1824005Ssam 1924005Ssam #ifndef LOCORE 2024005Ssam struct pte 2124005Ssam { 2224005Ssam unsigned int 2324005Ssam pg_v:1, /* valid bit */ 2424005Ssam pg_prot:4, /* access control */ 2524005Ssam pg_fod:1, /* is fill on demand (=0) */ 2625678Ssam :1, /* must write back to swap (unused) */ 2724005Ssam pg_nc:1, /* 'uncacheable page' bit */ 2824005Ssam pg_m:1, /* hardware maintained modified bit */ 2925678Ssam pg_u:1, /* hardware maintained 'used' bit */ 3024005Ssam pg_pfnum:22; /* core page frame number or 0 */ 3124005Ssam }; 3224005Ssam struct hpte 3324005Ssam { 3424005Ssam unsigned int 3524005Ssam pg_high:10, /* special for clustering */ 3624005Ssam pg_pfnum:22; 3724005Ssam }; 3824005Ssam struct fpte 3924005Ssam { 4024005Ssam unsigned int 4124005Ssam pg_v:1, 4224005Ssam pg_prot:4, 4324005Ssam pg_fod:1, /* is fill on demand (=1) */ 4424005Ssam :1, 4525678Ssam pg_fileno:1, /* file mapped from or TEXT or ZERO */ 4625678Ssam pg_blkno:24; /* file system block number */ 4724005Ssam }; 4824005Ssam #endif 4924005Ssam 5024005Ssam #define PG_V 0x80000000 5124005Ssam #define PG_PROT 0x78000000 /* all protection bits (dorit). */ 5224005Ssam #define PG_FOD 0x04000000 5324005Ssam #define PG_SWAPM 0x02000000 5424005Ssam #define PG_N 0x01000000 /* Non-cacheable */ 5524005Ssam #define PG_M 0x00800000 5634155Skarels #define PG_U 0x00400000 5724005Ssam #define PG_PFNUM 0x003fffff 5824005Ssam 5925678Ssam #define PG_FZERO 0 6025678Ssam #define PG_FTEXT 1 6124005Ssam #define PG_FMAX (PG_FTEXT) 6224005Ssam 6324005Ssam #define PG_NOACC 0 6424005Ssam #define PG_KR 0x40000000 6524005Ssam #define PG_KW 0x60000000 6624005Ssam #define PG_URKR 0x50000000 6724005Ssam #define PG_URKW 0x70000000 6824005Ssam #define PG_UW 0x78000000 6924005Ssam 7024005Ssam /* 7124005Ssam * Pte related macros 7224005Ssam */ 7331835Skarels #define dirty(pte) ((pte)->pg_m) 7424005Ssam 7534155Skarels /* 7634155Skarels * Kernel virtual address to page table entry and to physical address. 7734155Skarels */ 7834155Skarels #define kvtopte(va) (&Sysmap[((int)(va) &~ KERNBASE) >> PGSHIFT]) 7934155Skarels #define kvtophys(x) ((kvtopte(x)->pg_pfnum << PGSHIFT) | ((int)(x) & PGOFSET)) 8034155Skarels 8124005Ssam #ifndef LOCORE 8224005Ssam #ifdef KERNEL 8324005Ssam /* utilities defined in locore.s */ 8424005Ssam extern struct pte Sysmap[]; 8524005Ssam extern struct pte Usrptmap[]; 8624005Ssam extern struct pte usrpt[]; 8724005Ssam extern struct pte Swapmap[]; 8824005Ssam extern struct pte Forkmap[]; 8924005Ssam extern struct pte Xswapmap[]; 9024005Ssam extern struct pte Xswap2map[]; 9124005Ssam extern struct pte Pushmap[]; 9224005Ssam extern struct pte Vfmap[]; 9324005Ssam extern struct pte mmap[]; 9424005Ssam extern struct pte msgbufmap[]; 9531417Smckusick extern struct pte kmempt[], ekmempt[]; 96*37749Smckusick #ifdef NFS 97*37749Smckusick extern struct pte Nfsiomap[]; 9824005Ssam #endif 9924005Ssam #endif 100*37749Smckusick #endif 101