+}
+
+/*
+ * Change the mapping on a transmit buffer so that if_ubaget may
+ * receive from that buffer. Copy data from any pages mapped to Unibus
+ * into the pages mapped to normal kernel virtual memory, so that
+ * they can be accessed and swapped as usual. We take advantage
+ * of the fact that clusters are placed on the xtofree list
+ * in inverse order, finding the last one.
+ */
+static
+rcv_xmtbuf(ifw)
+ register struct ifxmt *ifw;
+{
+ register struct mbuf *m;
+ struct mbuf **mprev;
+ register i;
+ int t;
+ char *cp;
+
+ while (i = ffs((long)ifw->ifw_xswapd)) {
+ cp = ifw->ifw_base + i * CLBYTES;
+ i--;
+ ifw->ifw_xswapd &= ~(1<<i);
+ i *= CLSIZE;
+ mprev = &ifw->ifw_xtofree;
+ for (m = ifw->ifw_xtofree; m && m->m_next; m = m->m_next)
+ mprev = &m->m_next;
+ if (m == NULL)
+ panic("rcv_xmtbuf");
+ bcopy(mtod(m, caddr_t), cp, CLBYTES);
+ (void) m_free(m);
+ *mprev = NULL;
+ for (t = 0; t < CLSIZE; t++) {
+ ifw->ifw_mr[i] = ifw->ifw_wmap[i];
+ i++;
+ }
+ }
+}
+
+/*
+ * Put a transmit buffer back together after doing an if_ubaget on it,
+ * which may have swapped pages.
+ */
+static
+restor_xmtbuf(ifw)
+ register struct ifxmt *ifw;
+{
+ register i;
+
+ for (i = 0; i < ifw->ifw_nmr; i++)
+ ifw->ifw_wmap[i] = ifw->ifw_mr[i];