[comp.sys.sun] Sun 3/260 Virtual Address Caching Problem

dstewart@fas.ri.cmu.edu (David B Stewart) (10/19/89)

I would appreciate any pointers or ideas concerning the following problem:

We have an Ironics M68020 processor board, with 4 MBytes of memory, on the
VME backplane.  We have written a memory mapping driver which works on a
Sun 3/160, but not on a Sun 3/260.  We have tried both Sun OS Release 3.2
and Release 3.5.  

Sometimes when running my program, I get a segmentation fault when
accessing part of the memory mapped memory.  Using the dbx debugger,
however, I can access the memory even after the segmentation fault.  The
problem only happens some of the time, and not all the time; and not
always at the same place.  Since everything works fine on a Sun 3/160, I
assume the problem has to do with the Virtual Address Caching of the Sun
3/260.

I used the routine "vac_disable_kpage()", which supposedly disables the
caching mechanism on the memory mapped pages.  However, the problem
remained.  I could not find any documentation on this routine; I only
found out about it looking at the source code from a commercial driver.

As an added note:  We are not memory mapping the entire board at kernel
time, only a small portion of it.  We map the rest of the board during the
mmap call.  Again, this works on the Sun 3/160, but not on the 3/260.

The mmap routine we are using follows:

/*
*  ixmmmap() - allows user to memory map the entire processor memory.
*/

ixmmmap(dev, off, protection)
dev_t dev;
off_t off;
int protection;
{
    register XM_DEV_STATUS * xmd;
    register int page;

    xmd = ixmdevice + minor(dev);
    if(off >= xmd->cpu_size) return -1;  /* check for valid addr */

    if(off <= XM_MAP_SIZE) {	/* Memory previously mapped by kernel */
	page = getkpgmap(xmd->cpu_addr + off) & PG_PFNUM;
	vac_disable_kpage(xmd->cpu_addr + off);
    } else {			/* Memory not mapped by kernel */
	page = getkpgmap(xmd->cpu_addr) & PG_PFNUM;
	page += btop(off);
    }
    return page;
}  


If you have any clues, I would appreciate hearing from you.

David B. Stewart, Dept. of Electrical and Computer Engineering,
		and The Robotics Institute, Carnegie Mellon University
email: stewart@faraday.ece.cmu.edu, office: 412-268-7120; lab: 412-268-3652.