141058Swilliam /*- 241058Swilliam * Copyright (c) 1990 The Regents of the University of California. 341058Swilliam * All rights reserved. 441058Swilliam * 541058Swilliam * This code is derived from software contributed to Berkeley by 641058Swilliam * William Jolitz. 741058Swilliam * 841058Swilliam * %sccs.include.noredist.c% 941058Swilliam * 10*45595Sbill * @(#)pte.h 5.2 (Berkeley) 11/14/90 1141058Swilliam */ 1241058Swilliam 1340465Sbill /* 14*45595Sbill * 386 page table entry and page table directory 1540465Sbill * W.Jolitz, 8/89 1640465Sbill * 1740465Sbill * There are two major kinds of pte's: those which have ever existed (and are 1840465Sbill * thus either now in core or on the swap device), and those which have 1940465Sbill * never existed, but which will be filled on demand at first reference. 2040465Sbill * There is a structure describing each. There is also an ancillary 2140465Sbill * structure used in page clustering. 2240465Sbill */ 2340465Sbill 2440465Sbill #ifndef LOCORE 2541058Swilliam struct pde 2640465Sbill { 2740465Sbill unsigned int 2841058Swilliam pd_v:1, /* valid bit */ 2941058Swilliam pd_prot:2, /* access control */ 3041058Swilliam pd_mbz1:2, /* reserved, must be zero */ 3141058Swilliam pd_u:1, /* hardware maintained 'used' bit */ 3240465Sbill :1, /* not used */ 3341058Swilliam pd_mbz2:2, /* reserved, must be zero */ 3440465Sbill :3, /* reserved for software */ 3541058Swilliam pd_pfnum:20; /* physical page frame number of pte's*/ 3640465Sbill }; 3740465Sbill struct pte 3840465Sbill { 3940465Sbill unsigned int 4040465Sbill pg_v:1, /* valid bit */ 4140465Sbill pg_prot:2, /* access control */ 4240465Sbill pg_mbz1:2, /* reserved, must be zero */ 4340465Sbill pg_u:1, /* hardware maintained 'used' bit */ 4440465Sbill pg_m:1, /* hardware maintained modified bit */ 4540465Sbill pg_mbz2:2, /* reserved, must be zero */ 4640465Sbill pg_fod:1, /* is fill on demand (=0) */ 4740465Sbill :1, /* must write back to swap (unused) */ 4840465Sbill pg_nc:1, /* 'uncacheable page' bit */ 4940465Sbill pg_pfnum:20; /* physical page frame number */ 5040465Sbill }; 5140465Sbill struct hpte 5240465Sbill { 5340465Sbill unsigned int 5440465Sbill pg_high:12, /* special for clustering */ 5540465Sbill pg_pfnum:20; 5640465Sbill }; 5740465Sbill struct fpte 5840465Sbill { 5940465Sbill unsigned int 6040465Sbill pg_v:1, /* valid bit */ 6140465Sbill pg_prot:2, /* access control */ 6240465Sbill :5, 6340465Sbill pg_fileno:1, /* file mapped from or TEXT or ZERO */ 6440465Sbill pg_fod:1, /* is fill on demand (=1) */ 6540465Sbill pg_blkno:22; /* file system block number */ 6640465Sbill }; 6740465Sbill #endif 6840465Sbill 6941058Swilliam #define PD_MASK 0xffc00000 /* page directory address bits */ 7041058Swilliam #define PD_SHIFT 22 /* page directory address bits */ 7141058Swilliam 7240465Sbill #define PG_V 0x00000001 7340465Sbill #define PG_PROT 0x00000006 /* all protection bits . */ 7440465Sbill #define PG_FOD 0x00000200 7540465Sbill #define PG_SWAPM 0x00000400 7640465Sbill #define PG_N 0x00000800 /* Non-cacheable */ 7740465Sbill #define PG_M 0x00000040 7840465Sbill #define PG_U 0x00000020 /* not currently used */ 7941058Swilliam #define PG_FRAME 0xfffff000 8040465Sbill 8140465Sbill #define PG_FZERO 0 8240465Sbill #define PG_FTEXT 1 8340465Sbill #define PG_FMAX (PG_FTEXT) 8440465Sbill 8540465Sbill #define PG_NOACC 0 8640465Sbill #define PG_KR 0x00000000 8740465Sbill #define PG_KW 0x00000002 8840465Sbill #define PG_URKR 0x00000004 8940465Sbill #define PG_URKW 0x00000004 9040465Sbill #define PG_UW 0x00000006 9140465Sbill 9240465Sbill /* 9340465Sbill * Pte related macros 9440465Sbill */ 9540465Sbill #define dirty(pte) ((pte)->pg_m) 9640465Sbill 9740465Sbill #ifndef LOCORE 9840465Sbill #ifdef KERNEL 9940465Sbill /* utilities defined in locore.s */ 10040465Sbill extern struct pte Sysmap[]; 10140465Sbill extern struct pte Usrptmap[]; 10240465Sbill extern struct pte usrpt[]; 10340465Sbill extern struct pte Swapmap[]; 10440465Sbill extern struct pte Forkmap[]; 10540465Sbill extern struct pte Xswapmap[]; 10640465Sbill extern struct pte Xswap2map[]; 10740465Sbill extern struct pte Pushmap[]; 10840465Sbill extern struct pte Vfmap[]; 10940465Sbill extern struct pte mmap[]; 11040465Sbill extern struct pte msgbufmap[]; 11140465Sbill extern struct pte kmempt[], ekmempt[]; 11240465Sbill #endif 11340465Sbill #endif 114