Ausam/sys/dmr/unused/mem.c

Find at most related files.
including files from this version of Unix.

#
/*
 */
#include "../../unsw.h"

/*
 *	Memory special file
 *	minor device 0 is physical memory
 *	minor device 1 is kernel memory
 *	minor device 2 is EOF/RATHOLE
 *
 *	since kmem and mem identical up till end of bss
 *	can improve mmread by using copyout.
 *	this was done july 76  by ian j. and greg r.
 *
 */

#include "../param.h"
#include "../user.h"
#include "../conf.h"
#include "../seg.h"

mmread(dev)
{
	register c, bn, on;
	int a, d;	extern char end[];	/* unsw */

	if(dev.d_minor == 2)
		return;

/************************************************** unsw */
/*						    unsw */
/*	do it well				    unsw */
/*						    unsw */
/************************************************** unsw */

if( 	!u.u_offset[0] /* not too big */
   &&	((u.u_offset[1]+u.u_count)<end) /* within op-sys */
   &&	!(1&(u.u_offset[1]|u.u_base|u.u_count)) /* word aligned */
  ) {
      if(copyout(u.u_offset[1],u.u_base,u.u_count)) u.u_error = EFAULT; 
      u.u_offset[1]=+ u.u_count; u.u_count=0;
    }

/************************************************** unsw */
	else do {
		bn = lshift(u.u_offset, -6);
		on = u.u_offset[1] & 077;
		a = UISA->r[0];
		d = UISD->r[0];
		spl7();
		UISA->r[0] = bn;
		UISD->r[0] = 077406;
		if(dev.d_minor == 1)
			UISA->r[0] = (ka6-6)->r[(bn>>7)&07] + (bn & 0177);
		c = fuibyte(on);
		UISA->r[0] = a;
		UISD->r[0] = d;
		spl0();
	} while(u.u_error==0 && passc(c)>=0);
}

mmwrite(dev)
{
	register c, bn, on;
	int a, d;

	if(dev.d_minor == 2) {
		c = u.u_count;
		u.u_count = 0;
		u.u_base =+ c;
		dpadd(u.u_offset, c);
		return;
	}
	for(;;) {
		bn = lshift(u.u_offset, -6);
		on = u.u_offset[1] & 077;
		if ((c=cpass())<0 || u.u_error!=0)
			break;
		a = UISA->r[0];
		d = UISD->r[0];
		spl7();
		UISA->r[0] = bn;
		UISD->r[0] = 077406;
		if(dev.d_minor == 1)
			UISA->r[0] = (ka6-6)->r[(bn>>7)&07] + (bn & 0177);
		suibyte(on, c);
		UISA->r[0] = a;
		UISD->r[0] = d;
		spl0();
	}
}