BSD 4_4_Lite2 release
[unix-history] / usr / src / sys / hp300 / hp300 / pmap.c
index 68cfb67..6fe1246 100644 (file)
@@ -6,9 +6,35 @@
  * the Systems Programming Group of the University of Utah Computer
  * Science Department.
  *
  * the Systems Programming Group of the University of Utah Computer
  * Science Department.
  *
- * %sccs.include.redist.c%
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
  *
  *
- *     @(#)pmap.c      8.6 (Berkeley) %G%
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)pmap.c      8.7 (Berkeley) 5/17/95
  */
 
 /*
  */
 
 /*
@@ -1869,11 +1895,27 @@ pmap_remove_mapping(pmap, va, pte, flags)
         * PT page.
         */
        if (pmap != kernel_pmap) {
         * PT page.
         */
        if (pmap != kernel_pmap) {
+#if defined(DEBUG) && NCPUS == 1
+               /*
+                * XXX this recursive use of the VM won't work on a MP
+                * (or when otherwise debugging simple locks).  We might
+                * be called with the page queue lock held (e.g. from
+                * the pageout daemon) and vm_map_pageable might call
+                * vm_fault_unwire which would try to lock the page queues
+                * again.  For debugging we hack and drop the lock.
+                */
+               int hadit = !simple_lock_try(&vm_page_queue_lock);
+               simple_unlock(&vm_page_queue_lock);
+#endif
                (void) vm_map_pageable(pt_map, trunc_page(pte),
                                       round_page(pte+1), TRUE);
 #ifdef DEBUG
                if (pmapdebug & PDB_WIRING)
                        pmap_check_wiring("remove", trunc_page(pte));
                (void) vm_map_pageable(pt_map, trunc_page(pte),
                                       round_page(pte+1), TRUE);
 #ifdef DEBUG
                if (pmapdebug & PDB_WIRING)
                        pmap_check_wiring("remove", trunc_page(pte));
+#if NCPUS == 1
+               if (hadit)
+                       simple_lock(&vm_page_queue_lock);
+#endif
 #endif
        }
        /*
 #endif
        }
        /*