[comp.sys.sun] Help! Sun 3/60+CG4 strangeness

spaf@purdue.edu (Gene Spafford) (01/19/89)

Here's a really strange problem I'm having.  Any ideas or suggestions will
be greatly appreciated!

First, let me set the scene.  I'm working on putting in speedups to the
X11R3 server.  I'm working with my "Purdue" speedups, and I'm merging in
some new ideas and the "PurduePlus" speedups.  So far, so good.  People
all over the country are using these changes on their systems and they
work great.  However, on some systems, the screen suffers severe bit rot.
Some extensive debugging and enquiries reveal the following:

* The bitrot only appears on Sun 3/60+CG4 combinations.  The same code on
3/60+BW2, 3/50+BW2, 3/50+CG2, and 3/100+CG4 behaves perfectly.  It appears
to be OS independent, but I have no way to be 100% sure.

* The bitrot occurs when trying to execute a "bfins" instruction into a
location in the frame buffer.

* If the destination field is some set of nibbles (bytes) like:
   12345678 ABCDEFGH
and the destination is the bytes 45678ABC, then the insert goes fine, but
nibbles 1 & 2 also get trashed in seemingly random ways (I can't discern a
pattern).  The destruction is always to the first 8 bits, the stores are
always offset more than 8 bits, and it doesn't always happen.

* All bitfield addresses presented to the "bfins" instruction are 32-bit
aligned.

* Use of adb and trace statements show that the correct values are going
into the registers for the "bfins" instruction -- no registers are getting
trashed along the way.  The perfect behavior of the code on all other Sun
3 systems bears this out.

* Shift and mask instructions to those locations work fine, albeit much
slower.

The end result of all this is that the nicely tuned GCC "asm" macros in
the modified PurduePlus package just won't work for a 3/60+CG4 combo!  

I'm pretty well stumped.  I have tried nearly everything I can think of to
figure out why this is happening and how I might circumvent this behavior.
If any of you out there have any idea at all why this might be happening
or how I can investigate further, please let me know!  I've got a stack of
server optimizations I want to try, but I need a stable server platform
first, and I'd really like this as part of that platform!

Thanks in advance.
-- 
Gene Spafford
NSF/Purdue/U of Florida  Software Engineering Research Center,
Dept. of Computer Sciences, Purdue University, W. Lafayette IN 47907-2004
Internet:  spaf@cs.purdue.edu	uucp:	...!{decwrl,gatech,ucbvax}!purdue!spaf