pmap.h (15565) | pmap.h (15809) |
---|---|
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.37 1996/05/02 14:20:04 phk Exp $ | 45 * $Id: pmap.h,v 1.38 1996/05/02 22:25:18 phk Exp $ |
46 */ 47 48#ifndef _MACHINE_PMAP_H_ 49#define _MACHINE_PMAP_H_ 50 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. --- 10 unchanged lines hidden (view full) --- 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 /* \ */ 68 69 70/* Our various interpretations of the above */ 71#define PG_W PG_AVAIL1 /* "Wired" pseudoflag */ | 46 */ 47 48#ifndef _MACHINE_PMAP_H_ 49#define _MACHINE_PMAP_H_ 50 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. --- 10 unchanged lines hidden (view full) --- 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 /* \ */ 68 69 70/* Our various interpretations of the above */ 71#define PG_W PG_AVAIL1 /* "Wired" pseudoflag */ |
72#define PG_MANAGED PG_AVAIL2 |
|
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 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 89#ifndef NKPT | 73#define PG_FRAME (~PAGE_MASK) 74#define PG_PROT (PG_RW|PG_U) /* all protection bits . */ 75#define PG_N (PG_NC_PWT|PG_NC_PCD) /* Non-cacheable */ 76 77/* 78 * Page Protection Exception bits 79 */ 80 81#define PGEX_P 0x01 /* Protection violation vs. not present */ 82#define PGEX_W 0x02 /* during a Write cycle */ 83#define PGEX_U 0x04 /* access from User mode (UPL) */ 84 85/* 86 * Pte related macros 87 */ 88#define VADDR(pdi, pti) ((vm_offset_t)(((pdi)<<PDRSHIFT)|((pti)<<PAGE_SHIFT))) 89 90#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 | 91#define NKPT 9 /* actual number of kernel page tables */ 92#endif |
95#endif | |
96#ifndef NKPDE 97#define NKPDE 63 /* addressable number of page tables/pde's */ 98#endif 99 100/* 101 * The *PTDI values control the layout of virtual memory 102 * 103 * XXX This works for now, but I am not real happy with it, I'll fix it --- 10 unchanged lines hidden (view full) --- 114 */ 115#define ISA_HOLE_START 0xa0000 116#define ISA_HOLE_LENGTH (0x100000-ISA_HOLE_START) 117 118#ifndef LOCORE 119typedef unsigned int *pd_entry_t; 120typedef unsigned int *pt_entry_t; 121struct vm_map; | 93#ifndef NKPDE 94#define NKPDE 63 /* addressable number of page tables/pde's */ 95#endif 96 97/* 98 * The *PTDI values control the layout of virtual memory 99 * 100 * XXX This works for now, but I am not real happy with it, I'll fix it --- 10 unchanged lines hidden (view full) --- 111 */ 112#define ISA_HOLE_START 0xa0000 113#define ISA_HOLE_LENGTH (0x100000-ISA_HOLE_START) 114 115#ifndef LOCORE 116typedef unsigned int *pd_entry_t; 117typedef unsigned int *pt_entry_t; 118struct vm_map; |
119struct vm_object; |
|
122 123#define PDESIZE sizeof(pd_entry_t) /* for assembly files */ 124#define PTESIZE sizeof(pt_entry_t) /* for assembly files */ 125 126/* 127 * Address of current and alternate address space page table maps 128 * and directories. 129 */ --- 33 unchanged lines hidden (view full) --- 163#endif 164 165/* 166 * Pmap stuff 167 */ 168 169struct pmap { 170 pd_entry_t *pm_pdir; /* KVA of page directory */ | 120 121#define PDESIZE sizeof(pd_entry_t) /* for assembly files */ 122#define PTESIZE sizeof(pt_entry_t) /* for assembly files */ 123 124/* 125 * Address of current and alternate address space page table maps 126 * and directories. 127 */ --- 33 unchanged lines hidden (view full) --- 161#endif 162 163/* 164 * Pmap stuff 165 */ 166 167struct pmap { 168 pd_entry_t *pm_pdir; /* KVA of page directory */ |
169 vm_object_t pm_pteobj; /* Container for pte's */ |
|
171 short pm_dref; /* page directory ref count */ 172 short pm_count; /* pmap reference count */ 173 struct pmap_statistics pm_stats; /* pmap statistics */ 174 struct vm_map *pm_map; /* map that owns this pmap */ 175}; 176 177typedef struct pmap *pmap_t; 178 --- 19 unchanged lines hidden (view full) --- 198 199#ifdef KERNEL 200 201extern caddr_t CADDR1; 202extern pt_entry_t *CMAP1; 203extern vm_offset_t avail_end; 204extern vm_offset_t avail_start; 205extern vm_offset_t phys_avail[]; | 170 short pm_dref; /* page directory ref count */ 171 short pm_count; /* pmap reference count */ 172 struct pmap_statistics pm_stats; /* pmap statistics */ 173 struct vm_map *pm_map; /* map that owns this pmap */ 174}; 175 176typedef struct pmap *pmap_t; 177 --- 19 unchanged lines hidden (view full) --- 197 198#ifdef KERNEL 199 200extern caddr_t CADDR1; 201extern pt_entry_t *CMAP1; 202extern vm_offset_t avail_end; 203extern vm_offset_t avail_start; 204extern vm_offset_t phys_avail[]; |
206extern pv_entry_t pv_table; /* array of entries, one per page */ | 205extern pv_entry_t *pv_table; /* array of entries, one per page */ |
207extern vm_offset_t virtual_avail; 208extern vm_offset_t virtual_end; 209 210#define pa_index(pa) atop(pa - vm_first_phys) 211#define pa_to_pvh(pa) (&pv_table[pa_index(pa)]) 212 213#define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count) 214 215struct pcb; 216 217void pmap_bootstrap __P(( vm_offset_t, vm_offset_t)); 218pmap_t pmap_kernel __P((void)); 219void *pmap_mapdev __P((vm_offset_t, vm_size_t)); | 206extern vm_offset_t virtual_avail; 207extern vm_offset_t virtual_end; 208 209#define pa_index(pa) atop(pa - vm_first_phys) 210#define pa_to_pvh(pa) (&pv_table[pa_index(pa)]) 211 212#define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count) 213 214struct pcb; 215 216void pmap_bootstrap __P(( vm_offset_t, vm_offset_t)); 217pmap_t pmap_kernel __P((void)); 218void *pmap_mapdev __P((vm_offset_t, vm_size_t)); |
220pt_entry_t * __pure pmap_pte __P((pmap_t, vm_offset_t)) __pure2; 221void pmap_unuse_pt __P((pmap_t, vm_offset_t, vm_page_t)); | 219unsigned * __pure pmap_pte __P((pmap_t, vm_offset_t)) __pure2; 220int pmap_unuse_pt __P((pmap_t, vm_offset_t, vm_page_t)); |
222vm_page_t pmap_use_pt __P((pmap_t, vm_offset_t)); 223 224#endif /* KERNEL */ 225#endif /* !LOCORE */ 226 227#endif /* !_MACHINE_PMAP_H_ */ | 221vm_page_t pmap_use_pt __P((pmap_t, vm_offset_t)); 222 223#endif /* KERNEL */ 224#endif /* !LOCORE */ 225 226#endif /* !_MACHINE_PMAP_H_ */ |