pmap.c (f690bbace7e699c2e0bacc483107aef384b647d0) | pmap.c (0e195446b70cdb3130378505b24603031c1f3ce0) |
---|---|
1/* 2 * Copyright (c) 1991 Regents of the University of California. 3 * All rights reserved. 4 * Copyright (c) 1994 John S. Dyson 5 * All rights reserved. 6 * Copyright (c) 1994 David Greenman 7 * All rights reserved. 8 * --- 25 unchanged lines hidden (view full) --- 34 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 35 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 36 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 37 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 38 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 39 * SUCH DAMAGE. 40 * 41 * from: @(#)pmap.c 7.7 (Berkeley) 5/12/91 | 1/* 2 * Copyright (c) 1991 Regents of the University of California. 3 * All rights reserved. 4 * Copyright (c) 1994 John S. Dyson 5 * All rights reserved. 6 * Copyright (c) 1994 David Greenman 7 * All rights reserved. 8 * --- 25 unchanged lines hidden (view full) --- 34 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 35 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 36 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 37 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 38 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 39 * SUCH DAMAGE. 40 * 41 * from: @(#)pmap.c 7.7 (Berkeley) 5/12/91 |
42 * $Id: pmap.c,v 1.22 1994/03/30 02:17:45 davidg Exp $ | 42 * $Id: pmap.c,v 1.23 1994/04/14 07:49:38 davidg Exp $ |
43 */ 44 45/* 46 * Derived from hp300 version by Mike Hibler, this version by William 47 * Jolitz uses a recursive map [a pde points to the page directory] to 48 * map the page tables using the pagetables themselves. This is done to 49 * reduce the impact on kernel virtual memory for lots of sparse address 50 * space, and to reduce the cost of memory to each process. --- 97 unchanged lines hidden (view full) --- 148static inline void vm_put_pmap(); 149inline void pmap_use_pt(); 150inline void pmap_unuse_pt(); 151inline pt_entry_t * const pmap_pte(); 152static inline pv_entry_t get_pv_entry(); 153void pmap_alloc_pv_entry(); 154void pmap_clear_modify(); 155void i386_protection_init(); | 43 */ 44 45/* 46 * Derived from hp300 version by Mike Hibler, this version by William 47 * Jolitz uses a recursive map [a pde points to the page directory] to 48 * map the page tables using the pagetables themselves. This is done to 49 * reduce the impact on kernel virtual memory for lots of sparse address 50 * space, and to reduce the cost of memory to each process. --- 97 unchanged lines hidden (view full) --- 148static inline void vm_put_pmap(); 149inline void pmap_use_pt(); 150inline void pmap_unuse_pt(); 151inline pt_entry_t * const pmap_pte(); 152static inline pv_entry_t get_pv_entry(); 153void pmap_alloc_pv_entry(); 154void pmap_clear_modify(); 155void i386_protection_init(); |
156extern vm_offset_t pager_sva, pager_eva; |
|
156 157#if BSDVM_COMPAT 158#include "msgbuf.h" 159 160/* 161 * All those kernel PT submaps that BSD is so fond of 162 */ 163pt_entry_t *CMAP1, *CMAP2, *mmap; --- 682 unchanged lines hidden (view full) --- 846 847 pa = pmap_pte_pa(ptq); 848 oldpte = *ptq; 849 *ptq = 0; 850 851 if (pmap_is_managed(pa)) { 852 if ((((int) oldpte & PG_M) && (sva < USRSTACK || sva > UPT_MAX_ADDRESS)) 853 || (sva >= USRSTACK && sva < USRSTACK+(UPAGES*NBPG))) { | 157 158#if BSDVM_COMPAT 159#include "msgbuf.h" 160 161/* 162 * All those kernel PT submaps that BSD is so fond of 163 */ 164pt_entry_t *CMAP1, *CMAP2, *mmap; --- 682 unchanged lines hidden (view full) --- 847 848 pa = pmap_pte_pa(ptq); 849 oldpte = *ptq; 850 *ptq = 0; 851 852 if (pmap_is_managed(pa)) { 853 if ((((int) oldpte & PG_M) && (sva < USRSTACK || sva > UPT_MAX_ADDRESS)) 854 || (sva >= USRSTACK && sva < USRSTACK+(UPAGES*NBPG))) { |
854 m = PHYS_TO_VM_PAGE(pa); 855 m->flags &= ~PG_CLEAN; | 855 if (sva < pager_sva || sva >= pager_eva) { 856 m = PHYS_TO_VM_PAGE(pa); 857 m->flags &= ~PG_CLEAN; 858 } |
856 } 857 858 pv = pa_to_pvh(pa); 859 pmap_remove_entry(pmap, pv, sva); 860 pmap_unuse_pt(pmap, sva); 861 } 862 /* 863 * Pageout daemon is the process that calls pmap_remove --- 77 unchanged lines hidden (view full) --- 941 ++sva; 942 continue; 943 } 944 945 va = i386_ptob(sva); 946 947 if ((((int) oldpte & PG_M) && (va < USRSTACK || va > UPT_MAX_ADDRESS)) 948 || (va >= USRSTACK && va < USRSTACK+(UPAGES*NBPG))) { | 859 } 860 861 pv = pa_to_pvh(pa); 862 pmap_remove_entry(pmap, pv, sva); 863 pmap_unuse_pt(pmap, sva); 864 } 865 /* 866 * Pageout daemon is the process that calls pmap_remove --- 77 unchanged lines hidden (view full) --- 944 ++sva; 945 continue; 946 } 947 948 va = i386_ptob(sva); 949 950 if ((((int) oldpte & PG_M) && (va < USRSTACK || va > UPT_MAX_ADDRESS)) 951 || (va >= USRSTACK && va < USRSTACK+(UPAGES*NBPG))) { |
949 m = PHYS_TO_VM_PAGE(pa); 950 m->flags &= ~PG_CLEAN; | 952 if (va < pager_sva || va >= pager_eva) { 953 m = PHYS_TO_VM_PAGE(pa); 954 m->flags &= ~PG_CLEAN; 955 } |
951 } 952 953 pv = pa_to_pvh(pa); 954 pmap_remove_entry(pmap, pv, va); 955 pmap_unuse_pt(pmap, va); 956 ++sva; 957 reqactivate = 1; 958 } --- 54 unchanged lines hidden (view full) --- 1013 pmap->pm_stats.resident_count--; 1014 1015 /* 1016 * update the vm_page_t clean bit 1017 */ 1018 if ( (m->flags & PG_CLEAN) && 1019 ((((int) *pte) & PG_M) && (pv->pv_va < USRSTACK || pv->pv_va > UPT_MAX_ADDRESS)) 1020 || (pv->pv_va >= USRSTACK && pv->pv_va < USRSTACK+(UPAGES*NBPG))) { | 956 } 957 958 pv = pa_to_pvh(pa); 959 pmap_remove_entry(pmap, pv, va); 960 pmap_unuse_pt(pmap, va); 961 ++sva; 962 reqactivate = 1; 963 } --- 54 unchanged lines hidden (view full) --- 1018 pmap->pm_stats.resident_count--; 1019 1020 /* 1021 * update the vm_page_t clean bit 1022 */ 1023 if ( (m->flags & PG_CLEAN) && 1024 ((((int) *pte) & PG_M) && (pv->pv_va < USRSTACK || pv->pv_va > UPT_MAX_ADDRESS)) 1025 || (pv->pv_va >= USRSTACK && pv->pv_va < USRSTACK+(UPAGES*NBPG))) { |
1021 m->flags &= ~PG_CLEAN; | 1026 if (pv->pv_va < pager_sva || pv->pv_va >= pager_eva) { 1027 m->flags &= ~PG_CLEAN; 1028 } |
1022 } 1023 1024 *pte = 0; 1025 pmap_unuse_pt(pmap, pv->pv_va); 1026 1027 npv = pv->pv_next; 1028 if (npv) { 1029 *pv = *npv; --- 689 unchanged lines hidden (view full) --- 1719 */ 1720 if (pv->pv_pmap != NULL) { 1721 for (; pv; pv = pv->pv_next) { 1722 /* 1723 * if the bit being tested is the modified bit, 1724 * then mark UPAGES as always modified, and 1725 * ptes as never modified. 1726 */ | 1029 } 1030 1031 *pte = 0; 1032 pmap_unuse_pt(pmap, pv->pv_va); 1033 1034 npv = pv->pv_next; 1035 if (npv) { 1036 *pv = *npv; --- 689 unchanged lines hidden (view full) --- 1726 */ 1727 if (pv->pv_pmap != NULL) { 1728 for (; pv; pv = pv->pv_next) { 1729 /* 1730 * if the bit being tested is the modified bit, 1731 * then mark UPAGES as always modified, and 1732 * ptes as never modified. 1733 */ |
1734 if (bit & PG_U ) { 1735 if ((pv->pv_va >= pager_sva) && (pv->pv_va < pager_eva)) { 1736 continue; 1737 } 1738 } |
|
1727 if (bit & PG_M ) { 1728 if (pv->pv_va >= USRSTACK) { | 1739 if (bit & PG_M ) { 1740 if (pv->pv_va >= USRSTACK) { |
1741 if (pv->pv_va >= pager_sva && pv->pv_va < pager_eva) { 1742 continue; 1743 } |
|
1729 if (pv->pv_va < USRSTACK+(UPAGES*NBPG)) { 1730 splx(s); 1731 return TRUE; 1732 } 1733 else if (pv->pv_va < UPT_MAX_ADDRESS) { 1734 splx(s); 1735 return FALSE; 1736 } --- 38 unchanged lines hidden (view full) --- 1775 if (pv->pv_pmap != NULL) { 1776 for (; pv; pv = pv->pv_next) { 1777 va = pv->pv_va; 1778 1779 /* 1780 * don't write protect pager mappings 1781 */ 1782 if (!setem && (bit == PG_RW)) { | 1744 if (pv->pv_va < USRSTACK+(UPAGES*NBPG)) { 1745 splx(s); 1746 return TRUE; 1747 } 1748 else if (pv->pv_va < UPT_MAX_ADDRESS) { 1749 splx(s); 1750 return FALSE; 1751 } --- 38 unchanged lines hidden (view full) --- 1790 if (pv->pv_pmap != NULL) { 1791 for (; pv; pv = pv->pv_next) { 1792 va = pv->pv_va; 1793 1794 /* 1795 * don't write protect pager mappings 1796 */ 1797 if (!setem && (bit == PG_RW)) { |
1783 extern vm_offset_t pager_sva, pager_eva; 1784 | |
1785 if (va >= pager_sva && va < pager_eva) 1786 continue; 1787 } 1788 1789 pte = pmap_pte(pv->pv_pmap, va); 1790 if (setem) 1791 (int) npte = (int) *pte | bit; 1792 else --- 174 unchanged lines hidden --- | 1798 if (va >= pager_sva && va < pager_eva) 1799 continue; 1800 } 1801 1802 pte = pmap_pte(pv->pv_pmap, va); 1803 if (setem) 1804 (int) npte = (int) *pte | bit; 1805 else --- 174 unchanged lines hidden --- |