141058Swilliam /*- 2*63359Sbostic * Copyright (c) 1990, 1993 3*63359Sbostic * The Regents of the University of California. All rights reserved. 441058Swilliam * 541058Swilliam * This code is derived from software contributed to Berkeley by 641058Swilliam * William Jolitz. 741058Swilliam * 846006Swilliam * %sccs.include.redist.c% 941058Swilliam * 10*63359Sbostic * @(#)pte.h 8.1 (Berkeley) 06/11/93 1141058Swilliam */ 1241058Swilliam 1340465Sbill /* 1445595Sbill * 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 /* 9345597Sbill * Page Protection Exception bits 9445597Sbill */ 9545597Sbill 9645597Sbill #define PGEX_P 0x01 /* Protection violation vs. not present */ 9745597Sbill #define PGEX_W 0x02 /* during a Write cycle */ 9845597Sbill #define PGEX_U 0x04 /* access from User mode (UPL) */ 9945597Sbill 10045597Sbill /* 10140465Sbill * Pte related macros 10240465Sbill */ 10340465Sbill #define dirty(pte) ((pte)->pg_m) 10440465Sbill 10540465Sbill #ifndef LOCORE 10640465Sbill #ifdef KERNEL 10749523Swilliam /* utilities defined in pmap.c */ 10849523Swilliam extern struct pte *Sysmap; 10940465Sbill #endif 11040465Sbill #endif 111