152119Smckusick /* 252119Smckusick * Copyright (c) 1988 University of Utah. 3*63217Sbostic * Copyright (c) 1992, 1993 4*63217Sbostic * The Regents of the University of California. All rights reserved. 552119Smckusick * 652119Smckusick * This code is derived from software contributed to Berkeley by 752119Smckusick * the Systems Programming Group of the University of Utah Computer 852119Smckusick * Science Department and Ralph Campbell. 952119Smckusick * 1052119Smckusick * %sccs.include.redist.c% 1152119Smckusick * 1252119Smckusick * from: Utah $Hdr: pte.h 1.11 89/09/03$ 1352119Smckusick * 14*63217Sbostic * @(#)pte.h 8.1 (Berkeley) 06/10/93 1552119Smckusick */ 1652119Smckusick 1752119Smckusick /* 1852119Smckusick * R2000 hardware page table entry 1952119Smckusick */ 2052119Smckusick 2152119Smckusick #ifndef LOCORE 2252119Smckusick struct pte { 2352119Smckusick #if BYTE_ORDER == BIG_ENDIAN 2452119Smckusick unsigned int pg_pfnum:20, /* HW: core page frame number or 0 */ 2552119Smckusick pg_n:1, /* HW: non-cacheable bit */ 2652119Smckusick pg_m:1, /* HW: modified (dirty) bit */ 2752119Smckusick pg_v:1, /* HW: valid bit */ 2852119Smckusick pg_g:1, /* HW: ignore pid bit */ 2952119Smckusick :4, 3052119Smckusick pg_swapm:1, /* SW: page must be forced to swap */ 3152119Smckusick pg_fod:1, /* SW: is fill on demand (=0) */ 3252119Smckusick pg_prot:2; /* SW: access control */ 3352119Smckusick #endif 3452119Smckusick #if BYTE_ORDER == LITTLE_ENDIAN 3552119Smckusick unsigned int pg_prot:2, /* SW: access control */ 3652119Smckusick pg_fod:1, /* SW: is fill on demand (=0) */ 3752119Smckusick pg_swapm:1, /* SW: page must be forced to swap */ 3852119Smckusick :4, 3952119Smckusick pg_g:1, /* HW: ignore pid bit */ 4052119Smckusick pg_v:1, /* HW: valid bit */ 4152119Smckusick pg_m:1, /* HW: modified (dirty) bit */ 4252119Smckusick pg_n:1, /* HW: non-cacheable bit */ 4352119Smckusick pg_pfnum:20; /* HW: core page frame number or 0 */ 4452119Smckusick #endif 4552119Smckusick }; 4652119Smckusick 4759844Sralph typedef union pt_entry { 4852119Smckusick unsigned int pt_entry; /* for copying, etc. */ 4952119Smckusick struct pte pt_pte; /* for getting to bits by name */ 5052119Smckusick } pt_entry_t; /* Mach page table entry */ 5152119Smckusick #endif /* LOCORE */ 5252119Smckusick 5352119Smckusick #define PT_ENTRY_NULL ((pt_entry_t *) 0) 5452119Smckusick 5552119Smckusick #define PG_PROT 0x00000003 5652119Smckusick #define PG_RW 0x00000000 5752119Smckusick #define PG_RO 0x00000001 5852119Smckusick #define PG_WIRED 0x00000002 5952119Smckusick #define PG_G 0x00000100 6052119Smckusick #define PG_V 0x00000200 6152119Smckusick #define PG_NV 0x00000000 6252119Smckusick #define PG_M 0x00000400 6352119Smckusick #define PG_N 0x00000800 6452119Smckusick #define PG_FRAME 0xfffff000 6552119Smckusick #define PG_SHIFT 12 6652119Smckusick #define PG_PFNUM(x) (((x) & PG_FRAME) >> PG_SHIFT) 6752119Smckusick 6859844Sralph #if defined(KERNEL) && !defined(LOCORE) 6952119Smckusick /* 7052748Sralph * Kernel virtual address to page table entry and visa versa. 7152119Smckusick */ 7252119Smckusick #define kvtopte(va) \ 7359844Sralph (Sysmap + (((vm_offset_t)(va) - VM_MIN_KERNEL_ADDRESS) >> PGSHIFT)) 7452119Smckusick #define ptetokv(pte) \ 7559844Sralph ((((pt_entry_t *)(pte) - Sysmap) << PGSHIFT) + VM_MIN_KERNEL_ADDRESS) 7659844Sralph 7759844Sralph extern pt_entry_t *Sysmap; /* kernel pte table */ 7859844Sralph extern u_int Sysmapsize; /* number of pte's in Sysmap */ 7959844Sralph #endif 80