Question on strategy() routines for 4.1BSD drivers

T.BALLISTER 4363tcb at hou2d.UUCP
Thu Mar 22 02:00:26 AEST 1984


I've added an mmstratety() section to our mem.c driver to allow use of
some portion of addressable memory as a high speed block device.  The
intent is to provide a fast response for munerous *RTI* ingres commands.
(Many of these are 300-500Kbytes in length, and take 20-30 seconds to
load in via up.c devices on unibus).  The way the scheme works is to hack
the magic number 8096 in locore.s down to the number of kbytes you want
made available to the operating system, and then use the contents of
(physmem) as the start address of the block device.  The programs you put
in this device should not have their sticky bits set, because this would
cause them to be swapped out to real disk, and you wind up gaining little
on subsequent loads.

So far the driver works to the extent that I can make file systems, copy
things into them and around in them, mount the device to /tmp to speed up
compilations, etc.  I just can't load from it.  If I put in a trace printf
to get out things in the passed buf structure like b_flags, b_blkno,
b_bcount, b_un.b_addr, I notice that the problem comes as the text segment
begins to be loaded.  While the inode/directory blocks are being read, the
only flags up are B_BUSY and B_READ (defined in buf.h), and b_un.b_addr is
in system space, i.e. 0x8XXXXXXX.  When the first text block is read b_flags
is B_PGIN | B_PHYS | B_BUSY | B_READ, and b_un.b_addr is 0.  At this point
I get a protected segment error and things come to a stop.  Poking around
I've learned that the trouble is with the (user) b_un.b_addr = 0.  If I look
at the p0br and p0lr registers at this point, it looks like the size
register matches roughly the size of the program I'm trying to load in,
but if I examine the pte's pointed to by p0br they're all marked
0x790XXXXX.  i.e. they're all marked read only at all priority levels,
and the valid bit, 0x80000000, is off.

So the question is what is my driver not taking care of?  Obviously
bio() and swap(), which kick things off, work for other devices, but
looking around I haven't yet discovered what routine(s) I should be
calling to get these pages validated.  Any help out there?

				Tom Ballister
				hou2d!wb2!tcb
				(201)807-7498 (collect)
				   Thanks



More information about the Comp.unix.wizards mailing list