pmap.h (15543) | pmap.h (15565) |
---|---|
1/* 2 * Copyright (c) 1991 Regents of the University of California. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * the Systems Programming Group of the University of Utah Computer 7 * Science Department and William Jolitz of UUNET Technologies Inc. 8 * --- 28 unchanged lines hidden (view full) --- 37 * Derived from hp300 version by Mike Hibler, this version by William 38 * Jolitz uses a recursive map [a pde points to the page directory] to 39 * map the page tables using the pagetables themselves. This is done to 40 * reduce the impact on kernel virtual memory for lots of sparse address 41 * space, and to reduce the cost of memory to each process. 42 * 43 * from: hp300: @(#)pmap.h 7.2 (Berkeley) 12/16/90 44 * from: @(#)pmap.h 7.4 (Berkeley) 5/12/91 | 1/* 2 * Copyright (c) 1991 Regents of the University of California. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * the Systems Programming Group of the University of Utah Computer 7 * Science Department and William Jolitz of UUNET Technologies Inc. 8 * --- 28 unchanged lines hidden (view full) --- 37 * Derived from hp300 version by Mike Hibler, this version by William 38 * Jolitz uses a recursive map [a pde points to the page directory] to 39 * map the page tables using the pagetables themselves. This is done to 40 * reduce the impact on kernel virtual memory for lots of sparse address 41 * space, and to reduce the cost of memory to each process. 42 * 43 * from: hp300: @(#)pmap.h 7.2 (Berkeley) 12/16/90 44 * from: @(#)pmap.h 7.4 (Berkeley) 5/12/91 |
45 * $Id: pmap.h,v 1.36 1996/04/30 12:02:11 phk Exp $ | 45 * $Id: pmap.h,v 1.37 1996/05/02 14:20:04 phk Exp $ |
46 */ 47 48#ifndef _MACHINE_PMAP_H_ 49#define _MACHINE_PMAP_H_ 50 | 46 */ 47 48#ifndef _MACHINE_PMAP_H_ 49#define _MACHINE_PMAP_H_ 50 |
51#define PG_V 0x00000001 52#define PG_RW 0x00000002 53#define PG_u 0x00000004 54#define PG_PROT 0x00000006 /* all protection bits . */ 55#define PG_NC_PWT 0x00000008 /* page cache write through */ 56#define PG_NC_PCD 0x00000010 /* page cache disable */ 57#define PG_N 0x00000018 /* Non-cacheable */ 58#define PG_U 0x00000020 /* page was accessed */ 59#define PG_M 0x00000040 /* page was modified */ 60#define PG_PS 0x00000080 /* page is big size */ 61#define PG_G 0x00000100 /* page is global */ 62#define PG_W 0x00000200 /* "Wired" pseudoflag */ 63#define PG_FRAME 0xfffff000 | 51/* 52 * Page-directory and page-table entires follow this format, with a few 53 * of the fields not present here and there, depending on a lot of things. 54 */ 55 /* ---- Intel Nomenclature ---- */ 56#define PG_V 0x001 /* P Valid */ 57#define PG_RW 0x002 /* R/W Read/Write */ 58#define PG_U 0x004 /* U/S User/Supervisor */ 59#define PG_NC_PWT 0x008 /* PWT Write through */ 60#define PG_NC_PCD 0x010 /* PCD Cache disable */ 61#define PG_A 0x020 /* A Accessed */ 62#define PG_M 0x040 /* D Dirty */ 63#define PG_PS 0x080 /* PS Page size (0=4k,1=4M) */ 64#define PG_G 0x100 /* G Global */ 65#define PG_AVAIL1 0x200 /* / Available for system */ 66#define PG_AVAIL2 0x400 /* < programmers use */ 67#define PG_AVAIL3 0x800 /* \ */ |
64 | 68 |
65#define PG_KR 0x00000000 66#define PG_KW 0x00000002 | |
67 | 69 |
70/* Our various interpretations of the above */ 71#define PG_W PG_AVAIL1 /* "Wired" pseudoflag */ 72#define PG_FRAME (~PAGE_MASK) 73#define PG_PROT (PG_RW|PG_U) /* all protection bits . */ 74#define PG_N (PG_NC_PWT|PG_NC_PCD) /* Non-cacheable */ 75 |
|
68/* 69 * Page Protection Exception bits 70 */ 71 72#define PGEX_P 0x01 /* Protection violation vs. not present */ 73#define PGEX_W 0x02 /* during a Write cycle */ 74#define PGEX_U 0x04 /* access from User mode (UPL) */ 75 76/* 77 * Pte related macros 78 */ 79#define VADDR(pdi, pti) ((vm_offset_t)(((pdi)<<PDRSHIFT)|((pti)<<PAGE_SHIFT))) 80 | 76/* 77 * Page Protection Exception bits 78 */ 79 80#define PGEX_P 0x01 /* Protection violation vs. not present */ 81#define PGEX_W 0x02 /* during a Write cycle */ 82#define PGEX_U 0x04 /* access from User mode (UPL) */ 83 84/* 85 * Pte related macros 86 */ 87#define VADDR(pdi, pti) ((vm_offset_t)(((pdi)<<PDRSHIFT)|((pti)<<PAGE_SHIFT))) 88 |
81/* 82 * NKPDE controls the virtual space of the kernel, what ever is left, minus 83 * the alternate page table area is given to the user (NUPDE) 84 */ 85/* 86 * NKPDE controls the virtual space of the kernel, what ever is left is 87 * given to the user (NUPDE) 88 */ | |
89#ifndef NKPT 90#if 0 91#define NKPT 26 /* actual number of kernel page tables */ 92#else 93#define NKPT 9 /* actual number of kernel page tables */ 94#endif 95#endif 96#ifndef NKPDE --- 7 unchanged lines hidden (view full) --- 104 * right after I fix locore.s and the magic 28K hole 105 */ 106#define APTDPTDI (NPDEPG-1) /* alt ptd entry that points to APTD */ 107#define KPTDI (APTDPTDI-NKPDE)/* start of kernel virtual pde's */ 108#define PTDPTDI (KPTDI-1) /* ptd entry that points to ptd! */ 109#define KSTKPTDI (PTDPTDI-1) /* ptd entry for u./kernel&user stack */ 110#define KSTKPTEOFF (NPTEPG-UPAGES) /* pte entry for kernel stack */ 111 | 89#ifndef NKPT 90#if 0 91#define NKPT 26 /* actual number of kernel page tables */ 92#else 93#define NKPT 9 /* actual number of kernel page tables */ 94#endif 95#endif 96#ifndef NKPDE --- 7 unchanged lines hidden (view full) --- 104 * right after I fix locore.s and the magic 28K hole 105 */ 106#define APTDPTDI (NPDEPG-1) /* alt ptd entry that points to APTD */ 107#define KPTDI (APTDPTDI-NKPDE)/* start of kernel virtual pde's */ 108#define PTDPTDI (KPTDI-1) /* ptd entry that points to ptd! */ 109#define KSTKPTDI (PTDPTDI-1) /* ptd entry for u./kernel&user stack */ 110#define KSTKPTEOFF (NPTEPG-UPAGES) /* pte entry for kernel stack */ 111 |
112/* 113 * XXX doesn't really belong here I guess... 114 */ 115#define ISA_HOLE_START 0xa0000 116#define ISA_HOLE_LENGTH (0x100000-ISA_HOLE_START) 117 |
|
112#ifndef LOCORE 113typedef unsigned int *pd_entry_t; 114typedef unsigned int *pt_entry_t; 115struct vm_map; 116 117#define PDESIZE sizeof(pd_entry_t) /* for assembly files */ 118#define PTESIZE sizeof(pt_entry_t) /* for assembly files */ 119 --- 26 unchanged lines hidden (view full) --- 146 * Function: 147 * Extract the physical page address associated 148 * kernel virtual address. 149 */ 150static __inline vm_offset_t 151pmap_kextract(vm_offset_t va) 152{ 153 vm_offset_t pa = *(int *)vtopte(va); | 118#ifndef LOCORE 119typedef unsigned int *pd_entry_t; 120typedef unsigned int *pt_entry_t; 121struct vm_map; 122 123#define PDESIZE sizeof(pd_entry_t) /* for assembly files */ 124#define PTESIZE sizeof(pt_entry_t) /* for assembly files */ 125 --- 26 unchanged lines hidden (view full) --- 152 * Function: 153 * Extract the physical page address associated 154 * kernel virtual address. 155 */ 156static __inline vm_offset_t 157pmap_kextract(vm_offset_t va) 158{ 159 vm_offset_t pa = *(int *)vtopte(va); |
154 pa = (pa & PG_FRAME) | (va & ~PG_FRAME); | 160 pa = (pa & PG_FRAME) | (va & PAGE_MASK); |
155 return pa; 156} 157#endif 158 159/* 160 * Pmap stuff 161 */ 162 --- 59 unchanged lines hidden --- | 161 return pa; 162} 163#endif 164 165/* 166 * Pmap stuff 167 */ 168 --- 59 unchanged lines hidden --- |