pmap.h (17294) | pmap.h (17334) |
---|---|
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.40 1996/06/08 11:21:19 bde Exp $ | 45 * $Id: pmap.h,v 1.41 1996/07/27 03:23:32 dyson 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 | |
52/* 53 * Page-directory and page-table entires follow this format, with a few 54 * of the fields not present here and there, depending on a lot of things. 55 */ 56 /* ---- Intel Nomenclature ---- */ 57#define PG_V 0x001 /* P Valid */ 58#define PG_RW 0x002 /* R/W Read/Write */ 59#define PG_U 0x004 /* U/S User/Supervisor */ --- 49 unchanged lines hidden (view full) --- 109 110/* 111 * XXX doesn't really belong here I guess... 112 */ 113#define ISA_HOLE_START 0xa0000 114#define ISA_HOLE_LENGTH (0x100000-ISA_HOLE_START) 115 116#ifndef LOCORE | 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 */ --- 49 unchanged lines hidden (view full) --- 108 109/* 110 * XXX doesn't really belong here I guess... 111 */ 112#define ISA_HOLE_START 0xa0000 113#define ISA_HOLE_LENGTH (0x100000-ISA_HOLE_START) 114 115#ifndef LOCORE |
117 118#include <sys/queue.h> 119 | |
120typedef unsigned int *pd_entry_t; 121typedef unsigned int *pt_entry_t; 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 --- 29 unchanged lines hidden (view full) --- 157pmap_kextract(vm_offset_t va) 158{ 159 vm_offset_t pa = *(int *)vtopte(va); 160 pa = (pa & PG_FRAME) | (va & PAGE_MASK); 161 return pa; 162} 163#endif 164 | 116typedef unsigned int *pd_entry_t; 117typedef unsigned int *pt_entry_t; 118 119#define PDESIZE sizeof(pd_entry_t) /* for assembly files */ 120#define PTESIZE sizeof(pt_entry_t) /* for assembly files */ 121 122/* 123 * Address of current and alternate address space page table maps --- 29 unchanged lines hidden (view full) --- 153pmap_kextract(vm_offset_t va) 154{ 155 vm_offset_t pa = *(int *)vtopte(va); 156 pa = (pa & PG_FRAME) | (va & PAGE_MASK); 157 return pa; 158} 159#endif 160 |
165struct vm_page; 166 | |
167/* 168 * Pmap stuff 169 */ | 161/* 162 * Pmap stuff 163 */ |
170struct pv_entry; 171typedef struct { 172 int pv_list_count; 173 TAILQ_HEAD(,pv_entry) pv_list; 174} pv_table_t; | |
175 176struct pmap { 177 pd_entry_t *pm_pdir; /* KVA of page directory */ 178 vm_object_t pm_pteobj; /* Container for pte's */ | 164 165struct pmap { 166 pd_entry_t *pm_pdir; /* KVA of page directory */ 167 vm_object_t pm_pteobj; /* Container for pte's */ |
179 pv_table_t pm_pvlist; /* list of mappings in pmap */ 180 int pm_count; /* reference count */ | 168 short pm_dref; /* page directory ref count */ 169 short pm_count; /* pmap reference count */ |
181 struct pmap_statistics pm_stats; /* pmap statistics */ | 170 struct pmap_statistics pm_stats; /* pmap statistics */ |
182 struct vm_page *pm_ptphint; /* pmap ptp hint */ | 171 struct vm_map *pm_map; /* map that owns this pmap */ |
183}; 184 185typedef struct pmap *pmap_t; 186 187#ifdef KERNEL 188extern pmap_t kernel_pmap; 189#endif 190 | 172}; 173 174typedef struct pmap *pmap_t; 175 176#ifdef KERNEL 177extern pmap_t kernel_pmap; 178#endif 179 |
191 | |
192/* 193 * For each vm_page_t, there is a list of all currently valid virtual 194 * mappings of that page. An entry is a pv_entry_t, the list is pv_table. 195 */ 196typedef struct pv_entry { | 180/* 181 * For each vm_page_t, there is a list of all currently valid virtual 182 * mappings of that page. An entry is a pv_entry_t, the list is pv_table. 183 */ 184typedef struct pv_entry { |
185 struct pv_entry *pv_next; /* next pv_entry */ |
|
197 pmap_t pv_pmap; /* pmap where mapping lies */ 198 vm_offset_t pv_va; /* virtual address for mapping */ | 186 pmap_t pv_pmap; /* pmap where mapping lies */ 187 vm_offset_t pv_va; /* virtual address for mapping */ |
199 TAILQ_ENTRY(pv_entry) pv_list; 200 TAILQ_ENTRY(pv_entry) pv_plist; | |
201 vm_page_t pv_ptem; /* VM page for pte */ 202} *pv_entry_t; 203 204#define PV_ENTRY_NULL ((pv_entry_t) 0) 205 206#define PV_CI 0x01 /* all entries must be cache inhibited */ 207#define PV_PTPAGE 0x02 /* entry maps a page table page */ 208 209#ifdef KERNEL 210 211extern caddr_t CADDR1; 212extern pt_entry_t *CMAP1; 213extern vm_offset_t avail_end; 214extern vm_offset_t avail_start; 215extern vm_offset_t phys_avail[]; | 188 vm_page_t pv_ptem; /* VM page for pte */ 189} *pv_entry_t; 190 191#define PV_ENTRY_NULL ((pv_entry_t) 0) 192 193#define PV_CI 0x01 /* all entries must be cache inhibited */ 194#define PV_PTPAGE 0x02 /* entry maps a page table page */ 195 196#ifdef KERNEL 197 198extern caddr_t CADDR1; 199extern pt_entry_t *CMAP1; 200extern vm_offset_t avail_end; 201extern vm_offset_t avail_start; 202extern vm_offset_t phys_avail[]; |
216pv_table_t *pv_table; | 203extern pv_entry_t *pv_table; /* array of entries, one per page */ |
217extern vm_offset_t virtual_avail; 218extern vm_offset_t virtual_end; 219 220#define pa_index(pa) atop(pa - vm_first_phys) 221#define pa_to_pvh(pa) (&pv_table[pa_index(pa)]) 222 223#define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count) 224 --- 13 unchanged lines hidden --- | 204extern vm_offset_t virtual_avail; 205extern vm_offset_t virtual_end; 206 207#define pa_index(pa) atop(pa - vm_first_phys) 208#define pa_to_pvh(pa) (&pv_table[pa_index(pa)]) 209 210#define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count) 211 --- 13 unchanged lines hidden --- |