1: # 2: /* 3: */ 4: 5: /* 6: * Memory special file 7: * minor device 0 is physical memory 8: * minor device 1 is kernel memory 9: * minor device 2 is EOF/RATHOLE 10: */ 11: 12: #include "../param.h" 13: #include "../user.h" 14: #include "../conf.h" 15: #include "../seg.h" 16: 17: mmread(dev) 18: { 19: register c, bn, on; 20: int a, d; 21: 22: if(dev.d_minor == 2) 23: return; 24: do { 25: bn = lshift(u.u_offset, -6); 26: on = u.u_offset[1] & 077; 27: a = UISA->r[0]; 28: d = UISD->r[0]; 29: spl7(); 30: UISA->r[0] = bn; 31: UISD->r[0] = 077406; 32: if(dev.d_minor == 1) 33: UISA->r[0] = (ka6-6)->r[(bn>>7)&07] + (bn & 0177); 34: c = fuibyte(on); 35: UISA->r[0] = a; 36: UISD->r[0] = d; 37: spl0(); 38: } while(u.u_error==0 && passc(c)>=0); 39: } 40: 41: mmwrite(dev) 42: { 43: register c, bn, on; 44: int a, d; 45: 46: if(dev.d_minor == 2) { 47: c = u.u_count; 48: u.u_count = 0; 49: u.u_base =+ c; 50: dpadd(u.u_offset, c); 51: return; 52: } 53: for(;;) { 54: bn = lshift(u.u_offset, -6); 55: on = u.u_offset[1] & 077; 56: if ((c=cpass())<0 || u.u_error!=0) 57: break; 58: a = UISA->r[0]; 59: d = UISD->r[0]; 60: spl7(); 61: UISA->r[0] = bn; 62: UISD->r[0] = 077406; 63: if(dev.d_minor == 1) 64: UISA->r[0] = (ka6-6)->r[(bn>>7)&07] + (bn & 0177); 65: suibyte(on, c); 66: UISA->r[0] = a; 67: UISD->r[0] = d; 68: spl0(); 69: } 70: }