BSD 4_3 release
[unix-history] / usr / src / sys / sys / vm_drum.c
index 4eb3564..4a4315e 100644 (file)
@@ -1,18 +1,24 @@
-/*     vm_drum.c       6.1     83/07/29        */
+/*
+ * Copyright (c) 1982, 1986 Regents of the University of California.
+ * All rights reserved.  The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ *
+ *     @(#)vm_drum.c   7.1 (Berkeley) 6/5/86
+ */
 
 #include "../machine/pte.h"
 
 
 #include "../machine/pte.h"
 
-#include "../h/param.h"
-#include "../h/systm.h"
-#include "../h/dir.h"
-#include "../h/user.h"
-#include "../h/proc.h"
-#include "../h/buf.h"
-#include "../h/text.h"
-#include "../h/map.h"
-#include "../h/vm.h"
-#include "../h/cmap.h"
-#include "../h/kernel.h"
+#include "param.h"
+#include "systm.h"
+#include "dir.h"
+#include "user.h"
+#include "proc.h"
+#include "buf.h"
+#include "text.h"
+#include "map.h"
+#include "vm.h"
+#include "cmap.h"
+#include "kernel.h"
 
 /*
  * Expand the swap area for both the data and stack segments.
 
 /*
  * Expand the swap area for both the data and stack segments.
@@ -162,6 +168,8 @@ vsxfree(xp, ts)
  * Swap a segment of virtual memory to disk,
  * by locating the contiguous dirty pte's
  * and calling vschunk with each chunk.
  * Swap a segment of virtual memory to disk,
  * by locating the contiguous dirty pte's
  * and calling vschunk with each chunk.
+ * We ignore swap errors here because swap()
+ * will panic on an error when writing to disk.
  */
 vsswap(p, pte, type, vsbase, vscount, dmp)
        struct proc *p;
  */
 vsswap(p, pte, type, vsbase, vscount, dmp)
        struct proc *p;
@@ -171,6 +179,7 @@ vsswap(p, pte, type, vsbase, vscount, dmp)
        struct dmap *dmp;
 {
        register int size = 0;
        struct dmap *dmp;
 {
        register int size = 0;
+       register struct cmap *c;
 
        if (vscount % CLSIZE)
                panic("vsswap");
 
        if (vscount % CLSIZE)
                panic("vsswap");
@@ -191,7 +200,9 @@ vsswap(p, pte, type, vsbase, vscount, dmp)
                                        p->p_rssize -= vmemfree(pte, CLSIZE);
                } else {
                        size += CLSIZE;
                                        p->p_rssize -= vmemfree(pte, CLSIZE);
                } else {
                        size += CLSIZE;
-                       mwait(pte->pg_pfnum);
+                       c = &cmap[pgtocm(pte->pg_pfnum)];
+                       MLOCK(c);
+                       MUNLOCK(c);
                }
                vscount -= CLSIZE;
                if (type == CSTACK)
                }
                vscount -= CLSIZE;
                if (type == CSTACK)
@@ -218,7 +229,8 @@ vschunk(p, base, size, type, dmp)
                        db.db_size = dmtext - base % dmtext;
                        if (db.db_size > size)
                                db.db_size = size;
                        db.db_size = dmtext - base % dmtext;
                        if (db.db_size > size)
                                db.db_size = size;
-                       swap(p, p->p_textp->x_daddr[base/dmtext] + base%dmtext,
+                       (void)swap(p,
+                           p->p_textp->x_daddr[base/dmtext] + base%dmtext,
                            ptob(tptov(p, dtoc(base))), (int)dtob(db.db_size),
                            B_WRITE, 0, swapdev, 0);
                        pte = tptopte(p, dtoc(base));
                            ptob(tptov(p, dtoc(base))), (int)dtob(db.db_size),
                            B_WRITE, 0, swapdev, 0);
                        pte = tptopte(p, dtoc(base));
@@ -234,7 +246,7 @@ vschunk(p, base, size, type, dmp)
                v = type==CSTACK ?
                    sptov(p, dtoc(base+db.db_size)-1) :
                    dptov(p, dtoc(base));
                v = type==CSTACK ?
                    sptov(p, dtoc(base+db.db_size)-1) :
                    dptov(p, dtoc(base));
-               swap(p, db.db_base, ptob(v), (int)dtob(db.db_size),
+               (void)swap(p, db.db_base, ptob(v), (int)dtob(db.db_size),
                    B_WRITE, 0, swapdev, 0);
                pte = type==CSTACK ?
                    sptopte(p, dtoc(base+db.db_size)-1) :
                    B_WRITE, 0, swapdev, 0);
                pte = type==CSTACK ?
                    sptopte(p, dtoc(base+db.db_size)-1) :