pmap.c (6b4ac811ca8134f128cef476e2703bf9b5373016) pmap.c (f690bbace7e699c2e0bacc483107aef384b647d0)
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.21 1994/03/14 21:54:01 davidg Exp $
42 * $Id: pmap.c,v 1.22 1994/03/30 02:17:45 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.

--- 717 unchanged lines hidden (view full) ---

768void
769pmap_remove_entry(pmap, pv, va)
770 struct pmap *pmap;
771 pv_entry_t pv;
772 vm_offset_t va;
773{
774 pv_entry_t npv;
775 int wired;
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.

--- 717 unchanged lines hidden (view full) ---

768void
769pmap_remove_entry(pmap, pv, va)
770 struct pmap *pmap;
771 pv_entry_t pv;
772 vm_offset_t va;
773{
774 pv_entry_t npv;
775 int wired;
776 disable_intr();
776 int s;
777 s = splimp();
777 if (pmap == pv->pv_pmap && va == pv->pv_va) {
778 npv = pv->pv_next;
779 if (npv) {
780 *pv = *npv;
781 free_pv_entry(npv);
782 } else {
783 pv->pv_pmap = NULL;
784 }

--- 4 unchanged lines hidden (view full) ---

789 }
790 pv = npv;
791 }
792 if (npv) {
793 pv->pv_next = npv->pv_next;
794 free_pv_entry(npv);
795 }
796 }
778 if (pmap == pv->pv_pmap && va == pv->pv_va) {
779 npv = pv->pv_next;
780 if (npv) {
781 *pv = *npv;
782 free_pv_entry(npv);
783 } else {
784 pv->pv_pmap = NULL;
785 }

--- 4 unchanged lines hidden (view full) ---

790 }
791 pv = npv;
792 }
793 if (npv) {
794 pv->pv_next = npv->pv_next;
795 free_pv_entry(npv);
796 }
797 }
797 enable_intr();
798 splx(s);
798}
799
800/*
801 * Remove the given range of addresses from the specified map.
802 *
803 * It is assumed that the start and end are properly
804 * rounded to the page size.
805 */

--- 893 unchanged lines hidden (view full) ---

1699 */
1700static inline boolean_t
1701pmap_testbit(pa, bit)
1702 register vm_offset_t pa;
1703 int bit;
1704{
1705 register pv_entry_t pv;
1706 pt_entry_t *pte;
799}
800
801/*
802 * Remove the given range of addresses from the specified map.
803 *
804 * It is assumed that the start and end are properly
805 * rounded to the page size.
806 */

--- 893 unchanged lines hidden (view full) ---

1700 */
1701static inline boolean_t
1702pmap_testbit(pa, bit)
1703 register vm_offset_t pa;
1704 int bit;
1705{
1706 register pv_entry_t pv;
1707 pt_entry_t *pte;
1708 int s;
1707
1708 if (!pmap_is_managed(pa))
1709 return FALSE;
1710
1711 pv = pa_to_pvh(pa);
1709
1710 if (!pmap_is_managed(pa))
1711 return FALSE;
1712
1713 pv = pa_to_pvh(pa);
1712 disable_intr();
1714 s = splimp();
1713
1714 /*
1715 * Not found, check current mappings returning
1716 * immediately if found.
1717 */
1718 if (pv->pv_pmap != NULL) {
1719 for (; pv; pv = pv->pv_next) {
1720 /*
1721 * if the bit being tested is the modified bit,
1722 * then mark UPAGES as always modified, and
1723 * ptes as never modified.
1724 */
1725 if (bit & PG_M ) {
1726 if (pv->pv_va >= USRSTACK) {
1727 if (pv->pv_va < USRSTACK+(UPAGES*NBPG)) {
1715
1716 /*
1717 * Not found, check current mappings returning
1718 * immediately if found.
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 */
1727 if (bit & PG_M ) {
1728 if (pv->pv_va >= USRSTACK) {
1729 if (pv->pv_va < USRSTACK+(UPAGES*NBPG)) {
1728 enable_intr();
1730 splx(s);
1729 return TRUE;
1730 }
1731 else if (pv->pv_va < UPT_MAX_ADDRESS) {
1731 return TRUE;
1732 }
1733 else if (pv->pv_va < UPT_MAX_ADDRESS) {
1732 enable_intr();
1734 splx(s);
1733 return FALSE;
1734 }
1735 }
1736 }
1737 pte = pmap_pte(pv->pv_pmap, pv->pv_va);
1738 if ((int) *pte & bit) {
1735 return FALSE;
1736 }
1737 }
1738 }
1739 pte = pmap_pte(pv->pv_pmap, pv->pv_va);
1740 if ((int) *pte & bit) {
1739 enable_intr();
1741 splx(s);
1740 return TRUE;
1741 }
1742 }
1743 }
1742 return TRUE;
1743 }
1744 }
1745 }
1744 enable_intr();
1746 splx(s);
1745 return(FALSE);
1746}
1747
1748/*
1749 * this routine is used to modify bits in ptes
1750 */
1751static inline void
1752pmap_changebit(pa, bit, setem)

--- 6 unchanged lines hidden (view full) ---

1759 vm_offset_t va;
1760 int s;
1761 int reqactivate = 0;
1762
1763 if (!pmap_is_managed(pa))
1764 return;
1765
1766 pv = pa_to_pvh(pa);
1747 return(FALSE);
1748}
1749
1750/*
1751 * this routine is used to modify bits in ptes
1752 */
1753static inline void
1754pmap_changebit(pa, bit, setem)

--- 6 unchanged lines hidden (view full) ---

1761 vm_offset_t va;
1762 int s;
1763 int reqactivate = 0;
1764
1765 if (!pmap_is_managed(pa))
1766 return;
1767
1768 pv = pa_to_pvh(pa);
1767 disable_intr();
1769 s = splimp();
1768
1769 /*
1770 * Loop over all current mappings setting/clearing as appropos
1771 * If setting RO do we need to clear the VAC?
1772 */
1773 if (pv->pv_pmap != NULL) {
1774 for (; pv; pv = pv->pv_next) {
1775 va = pv->pv_va;

--- 14 unchanged lines hidden (view full) ---

1790 else
1791 (int) npte = (int) *pte & ~bit;
1792 if (*pte != npte) {
1793 *pte = npte;
1794 reqactivate = 1;
1795 }
1796 }
1797 }
1770
1771 /*
1772 * Loop over all current mappings setting/clearing as appropos
1773 * If setting RO do we need to clear the VAC?
1774 */
1775 if (pv->pv_pmap != NULL) {
1776 for (; pv; pv = pv->pv_next) {
1777 va = pv->pv_va;

--- 14 unchanged lines hidden (view full) ---

1792 else
1793 (int) npte = (int) *pte & ~bit;
1794 if (*pte != npte) {
1795 *pte = npte;
1796 reqactivate = 1;
1797 }
1798 }
1799 }
1798 enable_intr();
1800 splx(s);
1799 /*
1800 * tlbflush only if we need to
1801 */
1802 if( reqactivate && (curproc != pageproc))
1803 tlbflush();
1804}
1805
1806/*

--- 158 unchanged lines hidden ---
1801 /*
1802 * tlbflush only if we need to
1803 */
1804 if( reqactivate && (curproc != pageproc))
1805 tlbflush();
1806}
1807
1808/*

--- 158 unchanged lines hidden ---