Subject: Re: any action?
To: None <martin@duskware.de, uabfra@uab.ericsson.se>
From: None <eeh@netbsd.org>
List: port-sparc64
Date: 12/06/2000 17:29:10
	Martin Husemann wrote:

	> > but now it can't even find any runtime symbols from
	> > shared libraries, at least it says so.
	>
	> Gdb is quite broken on sparc64. It often can't find any local symbols,
	> even without shared libraries around.
	>
	> What were you trying to do vs. the X server?
	>
	> Martin

	I'm running on a Ultra 1 with a cgsix card, I cant find any X server for
	it

There is no functional X server distributed with 1.5.

	so I was trying to compile my own from the xsrc. It however crashes
	when I want to start a client (xterm). It crashes somewhere in

There are some partial fixes for the 64-bit X server but they have 
not been checked in because they are not a complete fix and would 
conflict with the 32-bit Xsun server.

	cfgblablablalba_glyphs. I just wanted to find out from where I came
	but the gdb wont do any backtracing.

gdb sometimes gets confused about the stack traces.  It's also
possible that the processor vectors off to some funny location
so it is not possible to get a stack trace.  I believe that
the latter is the problem in this case.  To work around this
issue you can run the program under gdb use single-stepping and
breakpoints to narrow down the cause of the fault.

	Is somebody working on the gdb? .

Not that I know of.

	PS.
	 Would it be possible to start a 32 bit Xserver on it?
	DS.

You can run a 32-bit X server with a 32-bit kernel, but 
it will not run under 32-bit emulation yet.

If you want to look into the problem I have attached 
the latest patch to the X server.  But bit-blits are
still broken in a way that will cause font corruption
in many circumstances.

Eduardo


Index: xc/config/cf/NetBSD.cf
===================================================================
RCS file: /cvsroot/xsrc/xc/config/cf/NetBSD.cf,v
retrieving revision 1.80
diff -u -r1.80 NetBSD.cf
--- xc/config/cf/NetBSD.cf	2000/11/06 12:58:18	1.80
+++ xc/config/cf/NetBSD.cf	2000/11/13 07:40:23
@@ -12,7 +12,7 @@
 XCOMM
 XCOMM 		NetBSD/i386	client/server
 XCOMM 		NetBSD/sparc	client/server
-XCOMM 		NetBSD/sparc64	client/server
+XCOMM 		NetBSD/sparc64	client/server (server has issues)
 XCOMM 		NetBSD/sun3	client/server
 XCOMM 		NetBSD/hp300	client
 XCOMM 		NetBSD/mac68k	client/server
Index: xc/programs/Xserver/XIE/mixie/process/bitfun.c
===================================================================
RCS file: /cvsroot/xsrc/xc/programs/Xserver/XIE/mixie/process/bitfun.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 bitfun.c
--- xc/programs/Xserver/XIE/mixie/process/bitfun.c	1997/03/15 06:10:55	1.1.1.1
+++ xc/programs/Xserver/XIE/mixie/process/bitfun.c	2000/11/13 07:40:24
@@ -167,11 +167,11 @@
 
 #if (IMAGE_BYTE_ORDER == MSBFirst)
 #define g4	(c = (inval>>26) & 0x3c, inval <<= 4,			\
-		*((CARD32 *) ((int) &xie8StippleMasks[0] + c)) & val)
+		*((CARD32 *) ((long) &xie8StippleMasks[0] + c)) & val)
 #define g4r	(c = (inval>>26) & 0x3c, inval <<= 4,			\
-		~(*((CARD32 *) ((int) &xie8StippleMasks[0] + c))) & val)
+		~(*((CARD32 *) ((long) &xie8StippleMasks[0] + c))) & val)
 #define g4b	(c = (inval>>26) & 0x3c, inval <<= 4,			\
-		 c = *((CARD32 *) ((int) &xie8StippleMasks[0] + c)), \
+		 c = *((CARD32 *) ((long) &xie8StippleMasks[0] + c)), \
 						(loval & ~c) | (hival & c))
 #else
 #define g4	(c = inval & 0xf, inval >>= 4, xie8StippleMasks[c] & val)
Index: xc/programs/Xserver/hw/sun/sunCursor.c
===================================================================
RCS file: /cvsroot/xsrc/xc/programs/Xserver/hw/sun/sunCursor.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 sunCursor.c
--- xc/programs/Xserver/hw/sun/sunCursor.c	1997/03/15 06:11:30	1.1.1.1
+++ xc/programs/Xserver/hw/sun/sunCursor.c	2000/11/13 07:40:25
@@ -86,6 +86,7 @@
     RegionRec	rgnDst;
     extern int mfbDoBitblt();
 
+ErrorF("sunCursorRepad");
     if (!(src = GetScratchPixmapHeader(pScreen, bits->width, bits->height,
 				       /*bpp*/ 1, /*depth*/ 1,
 				      PixmapBytePad(bits->width,1), src_bits)))
@@ -157,6 +158,23 @@
     }
     fbcursor.size.x = w;
     fbcursor.size.y = h;
+{
+	static u_char msk[32*32];
+	int i, j, k;
+	for (i=0; i<32*32; i++) msk[i] = 0xff;
+	fbcursor.mask = (char *)msk;
+
+	for (i=0; i<32; i++) {
+		for (j=0; j<8; j++) {
+			for (k=0; k<8; k++) {
+				if (fbcursor.image[i] & (1<<k)) ErrorF(".");
+				else ErrorF(" ");
+			}
+			ErrorF("|");
+		}
+		ErrorF("\n");
+	}
+}
 #ifndef Lynx
     (void) ioctl (sunFbs[pScreen->myNum].fd, FBIOSCURSOR, &fbcursor);
 #else
Index: xc/programs/Xserver/hw/sun/sunGX.c
===================================================================
RCS file: /cvsroot/xsrc/xc/programs/Xserver/hw/sun/sunGX.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 sunGX.c
--- xc/programs/Xserver/hw/sun/sunGX.c	1997/03/15 06:11:30	1.1.1.1
+++ xc/programs/Xserver/hw/sun/sunGX.c	2000/11/13 07:40:33
@@ -442,8 +442,8 @@
     int			dstLastx, dstRightx;
     int			xoffSrc, widthSrc, widthRest;
     int			widthLast;
-    unsigned long	*psrcBase, *psrcLine, *psrc;
-    unsigned long	bits, tmp, lastTmp;
+    unsigned long		*psrcBase, *psrcLine, *psrc;
+    unsigned long		bits, tmp, lastTmp;
     register int	leftShift, rightShift;
     register int	nl, nlMiddle;
     int			nbox;
@@ -457,6 +457,7 @@
     gx->mode = GX_BLIT_NOSRC | GX_MODE_COLOR1;
 
     cfbGetLongWidthAndPointer (pSrcDrawable, widthSrc, psrcBase)
+/*    cfbGetTypedWidthAndPointer (pSrcDrawable, widthSrc, psrcBase, unsigned long, unsigned long) */
 
     nbox = REGION_NUM_RECTS(prgnDst);
     pbox = REGION_RECTS(prgnDst);
@@ -1604,7 +1605,11 @@
 	h = pci->metrics.ascent + pci->metrics.descent;
 	bits = (unsigned long *) pci->bits;
 	while (h--) {
+#if     (BITMAP_BIT_ORDER == MSBFirst)
+	    gx->font = (*bits++)>>32;
+#else
 	    gx->font = *bits++;
+#endif
 	}
 	x += pci->metrics.characterWidth;
     }
@@ -1627,7 +1632,7 @@
     int		    w;
     FontPtr	    pfont = pGC->font;
     register int    r;
-    unsigned long   *char1, *char2, *char3, *char4;
+    unsigned int   *char1, *char2, *char3, *char4;
     int		    widthGlyphs, widthGlyph;
     BoxRec	    bbox;
     BoxPtr	    extents;
@@ -1691,10 +1696,10 @@
     {
 	widthGlyphs = widthGlyph << 2;
 	LoopIt(4, widthGlyphs,
-	    char1 = (unsigned long *) (*ppci++)->bits;
-	    char2 = (unsigned long *) (*ppci++)->bits;
-	    char3 = (unsigned long *) (*ppci++)->bits;
-	    char4 = (unsigned long *) (*ppci++)->bits;,
+	    char1 = (unsigned int *) (*ppci++)->bits;
+	    char2 = (unsigned int *) (*ppci++)->bits;
+	    char3 = (unsigned int *) (*ppci++)->bits;
+	    char4 = (unsigned int *) (*ppci++)->bits;,
 	    (*char1++ | ((*char2++ | ((*char3++ | (*char4++
 		    >> widthGlyph))
 		    >> widthGlyph))
@@ -1704,17 +1709,17 @@
     {
 	widthGlyphs = (widthGlyph << 1) + widthGlyph;
 	LoopIt(3, widthGlyphs,
-	    char1 = (unsigned long *) (*ppci++)->bits;
-	    char2 = (unsigned long *) (*ppci++)->bits;
-	    char3 = (unsigned long *) (*ppci++)->bits;,
+	    char1 = (unsigned int *) (*ppci++)->bits;
+	    char2 = (unsigned int *) (*ppci++)->bits;
+	    char3 = (unsigned int *) (*ppci++)->bits;,
 	    (*char1++ | ((*char2++ | (*char3++ >> widthGlyph)) >> widthGlyph)))
     }
     else if (widthGlyph <= 16)
     {
 	widthGlyphs = widthGlyph << 1;
 	LoopIt(2, widthGlyphs,
-	    char1 = (unsigned long *) (*ppci++)->bits;
-	    char2 = (unsigned long *) (*ppci++)->bits;,
+	    char1 = (unsigned int *) (*ppci++)->bits;
+	    char2 = (unsigned int *) (*ppci++)->bits;,
 	    (*char1++ | (*char2++ >> widthGlyph)))
     }
     while (nglyph--) {
@@ -1723,7 +1728,7 @@
 	gx->x0 = x;
 	gx->x1 = (x += widthGlyph) - 1;
 	gx->y0 = y;
-	char1 = (unsigned long *) (*ppci++)->bits;
+	char1 = (unsigned int *) (*ppci++)->bits;
 	hTmp = h;
 	while (hTmp--)
 	    gx->font = *char1++;
Index: xc/programs/Xserver/include/dix.h
===================================================================
RCS file: /cvsroot/xsrc/xc/programs/Xserver/include/dix.h,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 dix.h
--- xc/programs/Xserver/include/dix.h	1997/06/30 13:44:24	1.1.1.2
+++ xc/programs/Xserver/include/dix.h	2000/11/13 07:40:35
@@ -296,7 +296,8 @@
 extern ClientPtr serverClient;
 extern int currentMaxClients;
 
-#if !(defined(__alpha) || defined(__alpha__))
+#if !(defined(__alpha) || defined(__alpha__) || \
+      defined(__sparc_v9_))
 typedef long HWEventQueueType;
 #else
 typedef int HWEventQueueType;
Index: xc/programs/Xserver/include/servermd.h
===================================================================
RCS file: /cvsroot/xsrc/xc/programs/Xserver/include/servermd.h,v
retrieving revision 1.11
diff -u -r1.11 servermd.h
--- xc/programs/Xserver/include/servermd.h	2000/08/24 01:21:26	1.11
+++ xc/programs/Xserver/include/servermd.h	2000/11/13 07:40:37
@@ -197,7 +197,12 @@
 # define AVOID_MEMORY_READ
 # define LARGE_INSTRUCTION_CACHE
 # define FAST_CONSTANT_OFFSET_MODE
-# define SHARED_IDCACHE
+# if !defined(__sparc_v9__) && !defined(__arch64__)
+#  define SHARED_IDCACHE
+# else
+#  define LARGE_INSTRUCTION_CACHE
+#  define PLENTIFUL_REGISTERS
+# endif
 #endif
 
 #if defined(__sparc_v9__) || ((defined(__sparc__) || defined(sparc)) && defined(__arch64__))
Index: xc/programs/Xserver/mfb/maskbits.h
===================================================================
RCS file: /cvsroot/xsrc/xc/programs/Xserver/mfb/maskbits.h,v
retrieving revision 1.2
diff -u -r1.2 maskbits.h
--- xc/programs/Xserver/mfb/maskbits.h	1998/07/01 15:12:56	1.2
+++ xc/programs/Xserver/mfb/maskbits.h	2000/11/13 07:40:39
@@ -255,7 +255,7 @@
                         | ( ( ( x ) & (unsigned long)0x00FF0000 ) >> 0x08 ) \
                         | ( ( ( x ) & (unsigned long)0xFF000000 ) >> 0x18 ) )
 #else /* PPW == 64 */
-#if defined( __alpha__)
+#if defined( __alpha__) || defined(__sparc_v9__)
 #define LONG2CHARS( x ) \
       ( ( ( ( x ) & 0x000000FFUL) << 0x38 ) \
       | ( ( ( x ) & 0x0000FF00UL) << 0x28 ) \
Index: xc/programs/Xserver/mfb/mfbtegblt.c
===================================================================
RCS file: /cvsroot/xsrc/xc/programs/Xserver/mfb/mfbtegblt.c,v
retrieving revision 1.3
diff -u -r1.3 mfbtegblt.c
--- xc/programs/Xserver/mfb/mfbtegblt.c	1998/11/23 21:32:57	1.3
+++ xc/programs/Xserver/mfb/mfbtegblt.c	2000/11/13 07:40:40
@@ -1,15 +1,10 @@
-/* $XConsortium: mfbtegblt.c,v 5.14 94/04/17 20:28:35 dpw Exp $ */
+/* $TOG: mfbtegblt.c /main/19 1998/02/09 14:40:20 kaleb $ */
 /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
 /***********************************************************
 
-Copyright (c) 1987  X Consortium
+Copyright 1987, 1998  The Open Group
 
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
+All Rights Reserved.
 
 The above copyright notice and this permission notice shall be included in
 all copies or substantial portions of the Software.
@@ -17,13 +12,13 @@
 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
-Except as contained in this notice, the name of the X Consortium shall not be
+Except as contained in this notice, the name of The Open Group shall not be
 used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from the X Consortium.
+in this Software without prior written authorization from The Open Group.
 
 
 Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
@@ -47,7 +42,9 @@
 SOFTWARE.
 
 ******************************************************************/
-/* $XFree86: xc/programs/Xserver/mfb/mfbtegblt.c,v 1.1.1.1.12.2 1998/10/04 15:23:03 hohndel Exp $ */
+
+/* $XFree86: xc/programs/Xserver/mfb/mfbtegblt.c,v 1.6 2000/02/12 03:40:03 dawes Exp $ */
+
 #include	"X.h"
 #include	"Xmd.h"
 #include	"Xproto.h"
@@ -113,78 +110,31 @@
  * (DHD)
  */
 #if BITMAP_BIT_ORDER == IMAGE_BYTE_ORDER
-#if PPW == 32
 #define GetBits4    c = (*char1++ << ShiftAmnt) | \
 			SCRRIGHT (*char2++ << ShiftAmnt, xoff2) | \
 			SCRRIGHT (*char3++ << ShiftAmnt, xoff3) | \
 			SCRRIGHT (*char4++ << ShiftAmnt, xoff4);
-#else /* PPW */
-#define GetBits4    c = ((unsigned long)(*char1++ << ShiftAmnt) << 32 )  | \
-			(SCRRIGHT (*char2++ << ShiftAmnt, xoff2) << 32 ) | \
-			(SCRRIGHT (*char3++ << ShiftAmnt, xoff3) << 32 ) | \
-			(SCRRIGHT (*char4++ << ShiftAmnt, xoff4) << 32 ) | \
-			(*char5++ << ShiftAmnt) 			 | \
-			SCRRIGHT (*char6++ << ShiftAmnt, xoff6) 	 | \
-			SCRRIGHT (*char7++ << ShiftAmnt, xoff7) 	 | \
-			SCRRIGHT (*char8++ << ShiftAmnt, xoff8);
-#endif /* PPW */
 #else /* BITMAP_BIT_ORDER != IMAGE_BYTE_ORDER */
-#if PPW == 32
 #define GetBits4    c = (*char1++ << ShiftAmnt) | \
 			SCRRIGHT (*char2 << ShiftAmnt, xoff2) | \
 			SCRRIGHT (*char3 << ShiftAmnt, xoff3) | \
 			SCRRIGHT (*char4 << ShiftAmnt, xoff4); \
 			char2++; char3++; char4++;
-#else /* PPW == 64 */
-#define GetBits4    c = ((unsigned long)(*char1++ << ShiftAmnt) << 32 )  | \
-			(SCRRIGHT (*char2 << ShiftAmnt, xoff2) << 32 ) | \
-			(SCRRIGHT (*char3 << ShiftAmnt, xoff3) << 32 ) | \
-			(SCRRIGHT (*char4 << ShiftAmnt, xoff4) << 32 ) | \
-			(*char5++ << ShiftAmnt) 			 | \
-			SCRRIGHT (*char6 << ShiftAmnt, xoff6) 	 | \
-			SCRRIGHT (*char7 << ShiftAmnt, xoff7) 	 | \
-			SCRRIGHT (*char8 << ShiftAmnt, xoff8); \
-			char2++; char3++; char4++; char6++; char7++; char8++;
-#endif /* PPW */
 #endif /* BITMAP_BIT_ORDER == IMAGE_BYTE_ORDER */
 
 #else /* (BITMAP_BIT_ORDER != MSBFirst) || (GLYPHPADBYTES == 4) */
 
 #if BITMAP_BIT_ORDER == IMAGE_BYTE_ORDER
-#if PPW == 32
 #define GetBits4    c = *char1++ | \
 			SCRRIGHT (*char2++, xoff2) | \
 			SCRRIGHT (*char3++, xoff3) | \
 			SCRRIGHT (*char4++, xoff4);
-#else /* PPW == 64 */
-#define GetBits4    c = (unsigned long)(((*char1++) << 64 ) | \
-                        (SCRRIGHT (*char2++, xoff2) << 64 ) | \
-                        (SCRRIGHT (*char3++, xoff3) << 64 ) | \
-                        (SCRRIGHT (*char4++, xoff4) << 64 ) | \
-                        SCRRIGHT (*char5++, xoff5)          | \
-                        SCRRIGHT (*char6++, xoff6)          | \
-                        SCRRIGHT (*char7++, xoff7)          | \
-                        SCRRIGHT (*char8++, xoff8));
-#endif /* PPW */
 #else /* BITMAP_BIT_ORDER != IMAGE_BYTE_ORDER */
-#if PPW == 32
 #define GetBits4    c = *char1++ | \
 			SCRRIGHT (*char2, xoff2) | \
 			SCRRIGHT (*char3, xoff3) | \
 			SCRRIGHT (*char4, xoff4); \
 			char2++; char3++; char4++;
-#else /* PPW == 64 */
-#define GetBits4    c = (unsigned long)(((*char1++) << 64 ) | \
-                        (SCRRIGHT (*char2, xoff2) << 64 ) | \
-                        (SCRRIGHT (*char3, xoff3) << 64 ) | \
-                        (SCRRIGHT (*char4, xoff4) << 64 ) | \
-                        SCRRIGHT (*char5, xoff5)          | \
-                        SCRRIGHT (*char6, xoff6)          | \
-                        SCRRIGHT (*char7, xoff7)          | \
-                        SCRRIGHT (*char8, xoff8)); \
-			char2++; char3++; char4++; \
-			char5++; char6++; char7++; char8++;
-#endif /* PPW */
 #endif /* BITMAP_BIT_ORDER == IMAGE_BYTE_ORDER */
 
 #endif /* BITMAP_BIT_ORDER && GLYPHPADBYTES */
@@ -240,10 +190,6 @@
     register PixelType  c;
     register int	    xoff1, xoff2, xoff3, xoff4;
     register glyphPointer   char1, char2, char3, char4;
-#if PPW == 64
-    register int	    xoff5, xoff6, xoff7, xoff8;
-    register glyphPointer   char5, char6, char7, char8;
-#endif /* PPW */
 
 #ifdef USE_LEFTBITS
     register PixelType  glyphMask;
@@ -271,7 +217,7 @@
     bbox.y2 = ypos + h;
 
     switch (RECT_IN_REGION(pGC->pScreen, 
-           ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip, &bbox))
+	((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip, &bbox))
     {
       case rgnPART:
 	/* this is the WRONG thing to do, but it works.
@@ -315,22 +261,10 @@
 	    xoff2 = widthGlyph;
 	    xoff3 = xoff2 + widthGlyph;
 	    xoff4 = xoff3 + widthGlyph;
-#if PPW == 64
-	    xoff5 = xoff4 + widthGlyph;
-	    xoff6 = xoff5 + widthGlyph;
-	    xoff7 = xoff6 + widthGlyph;
-	    xoff8 = xoff7 + widthGlyph;
-#endif /* PPW */
 	    char1 = (glyphPointer) FONTGLYPHBITS(pglyphBase,(*ppci++));
 	    char2 = (glyphPointer) FONTGLYPHBITS(pglyphBase,(*ppci++));
 	    char3 = (glyphPointer) FONTGLYPHBITS(pglyphBase,(*ppci++));
 	    char4 = (glyphPointer) FONTGLYPHBITS(pglyphBase,(*ppci++));
-#if PPW == 64
-	    char5 = (glyphPointer) FONTGLYPHBITS(pglyphBase,(*ppci++));
-	    char6 = (glyphPointer) FONTGLYPHBITS(pglyphBase,(*ppci++));
-	    char7 = (glyphPointer) FONTGLYPHBITS(pglyphBase,(*ppci++));
-	    char8 = (glyphPointer) FONTGLYPHBITS(pglyphBase,(*ppci++));
-#endif /* PPW */
 
 	    hTmp = h;
 	    dst = mfbScanlineOffset(pdstBase, (xpos >> PWSH)); /* switch now */
@@ -349,7 +283,7 @@
 # endif
 		    FASTPUTBITS(OP(c), xoff1, widthGlyphs, dst);
 #else
-		    *(dst) = (*dst) & ~startmask | OP(SCRRIGHT(c, xoff1)) & startmask;
+		    *(dst) = ((*dst) & ~startmask) | (OP(SCRRIGHT(c, xoff1)) & startmask);
 #endif
 		    mfbScanlineInc(dst, widthDst);
 		}
@@ -362,10 +296,10 @@
 		while (hTmp--)
 		{
 		    GetBits4
-		    dst[0] = dst[0] & ~startmask |
-			     OP(SCRRIGHT(c,xoff1)) & startmask;
-		    dst[1] = dst[1] & ~endmask |
-			     OP(SCRLEFT(c,nfirst)) & endmask;
+		    dst[0] = (dst[0] & ~startmask) |
+			     (OP(SCRRIGHT(c,xoff1)) & startmask);
+		    dst[1] = (dst[1] & ~endmask) |
+			     (OP(SCRLEFT(c,nfirst)) & endmask);
 		    mfbScanlineInc(dst, widthDst);
 		}
 	    }
@@ -401,7 +335,7 @@
 		FASTPUTBITS (OP(c),xoff1,widthGlyph,dst);
 #else
 		GetBits1
-		(*dst) = (*dst) & ~startmask | OP(SCRRIGHT(c, xoff1)) & startmask;
+		(*dst) = ((*dst) & ~startmask) | (OP(SCRRIGHT(c, xoff1)) & startmask);
 #endif
 		mfbScanlineInc(dst, widthDst);
 	    }
@@ -414,10 +348,10 @@
 	    while (hTmp--)
 	    {
 		GetBits1
-		dst[0] = dst[0] & ~startmask |
-			 OP(SCRRIGHT(c,xoff1)) & startmask;
-		dst[1] = dst[1] & ~endmask |
-			 OP(SCRLEFT(c,nfirst)) & endmask;
+		dst[0] = (dst[0] & ~startmask) |
+			 (OP(SCRRIGHT(c,xoff1)) & startmask);
+		dst[1] = (dst[1] & ~endmask) |
+			 (OP(SCRLEFT(c,nfirst)) & endmask);
 		mfbScanlineInc(dst, widthDst);
 	    }
 	}
Index: xc/test/xsuite/xtest/src/libproto/Expect.c
===================================================================
RCS file: /cvsroot/xsrc/xc/test/xsuite/xtest/src/libproto/Expect.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 Expect.c
--- xc/test/xsuite/xtest/src/libproto/Expect.c	1998/03/08 09:18:06	1.1.1.2
+++ xc/test/xsuite/xtest/src/libproto/Expect.c	2000/11/13 07:40:41
@@ -72,7 +72,7 @@
 
 extern int  errno;
 extern int  sys_nerr;
-#if !defined(CSRG_BASED) && !defined(linux)
+#if !defined(CSRG_BASED) && !defined(linux) && !defined(__NetBSD__)
 extern char *sys_errlist[];
 #endif
 
Index: xc/test/xsuite/xtest/src/libproto/Utils.c
===================================================================
RCS file: /cvsroot/xsrc/xc/test/xsuite/xtest/src/libproto/Utils.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 Utils.c
--- xc/test/xsuite/xtest/src/libproto/Utils.c	1998/03/08 09:18:08	1.1.1.2
+++ xc/test/xsuite/xtest/src/libproto/Utils.c	2000/11/13 07:40:41
@@ -97,7 +97,7 @@
 	return(buf);
 }
 
-#if !defined(CSRG_BASED) && !defined(linux)
+#if !defined(CSRG_BASED) && !defined(linux) && !defined(__NetBSD__)
 /*
  * These are routines found in BSD and not found in SYSV.
  */
Index: xc/test/xsuite/xtest/src/libproto/XstIO.c
===================================================================
RCS file: /cvsroot/xsrc/xc/test/xsuite/xtest/src/libproto/XstIO.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 XstIO.c
--- xc/test/xsuite/xtest/src/libproto/XstIO.c	1998/03/08 09:18:09	1.1.1.2
+++ xc/test/xsuite/xtest/src/libproto/XstIO.c	2000/11/13 07:40:42
@@ -69,7 +69,7 @@
 
 extern int errno;
 extern int sys_nerr;
-#if !defined(CSRG_BASED) && !defined(linux)
+#if !defined(CSRG_BASED) && !defined(linux) && !defined(__NetBSD__)
 extern char *sys_errlist[];
 #endif