+ switch(flag){
+ case ECC:
+ npf--;
+ reg--;
+ mask = up->upec2;
+ printf("up%d%c: soft ecc sn%d\n", dkunit(bp),
+ 'a'+(minor(bp->b_dev)&07), bp->b_blkno + npf);
+ /*
+ * Flush the buffered data path, and compute the
+ * byte and bit position of the error. The variable i
+ * is the byte offset in the transfer, the variable byte
+ * is the offset from a page boundary in main memory.
+ */
+ i = up->upec1 - 1; /* -1 makes 0 origin */
+ bit = i&07;
+ i = (i&~07)>>3;
+ byte = i + o;
+ /*
+ * Correct while possible bits remain of mask. Since mask
+ * contains 11 bits, we continue while the bit offset is > -11.
+ * Also watch out for end of this block and the end of the whole
+ * transfer.
+ */
+ while (i < 512 && (int)ptob(npf)+i < bp->b_bcount && bit > -11) {
+ addr = ptob(ubp->uba_map[reg+btop(byte)].pg_pfnum)+
+ (byte & PGOFSET);
+#ifdef UPECCDEBUG
+ printf("addr %x map reg %x\n",
+ addr, *(int *)(&ubp->uba_map[reg+btop(byte)]));
+ printf("old: %x, ", getmemc(addr));
+#endif
+ putmemc(addr, getmemc(addr)^(mask<<bit));