From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <9605070748.AA16866@nova.tat.physik.uni-tuebingen.de> Date: Tue, 7 May 1996 09:56:32 +0200 (MET DST) From: Harald Koenig Subject: one more alignment trap my first fix for s3im.c wasn't sufficient. there may be odd addresses too which was showed by some "x11perf" runs last night. so here is a more gerenal (and ugly) fix relative to the original sources. I havent tested this one (only compiled,not run yet) so look at it and be careful. Harald ------------------------------------------------------------------------------- --- /soft/r6/xc/programs/Xserver/hw/xfree86/accel/s3/s3im.c.Df Sun Apr 28 23:56:35 1996 +++ /soft/r6/xc/programs/Xserver/hw/xfree86/accel/s3/s3im.c Tue May 7 09:49:40 1996 @@ -882,7 +882,7 @@ short *psrcs = (short *)&psrc[px*s3Bpp]; for (i = 0; i < w; ) { if (s3InfoRec.bitsPerPixel == 32) { - outl (PIX_TRANS, *((long*)(psrcs))); + outl (PIX_TRANS, *((int*)(psrcs))); psrcs+=2; i += 4; } @@ -1164,11 +1164,48 @@ ((unsigned char *)(ptmp) + (srcx >> 3)); x2 = srcx & 7; /* Offset within byte. */ if( np >= 16 ) { +#ifdef __alpha__ /* alignment check */ + switch ((long)pnt & 3) { + case 0: pix = (unsigned short)(*((unsigned int *)(pnt)) >> x2); + break; + case 2: + pix = (unsigned short)((*pnt | (*(pnt+1)<<16)) >> x2); + break; + default: + pix = (unsigned short)(( ((unsigned char *)(pnt))[0]<<0 | + ((unsigned char *)(pnt))[1]<<8 | + ((unsigned char *)(pnt))[2]<<16 | + ((unsigned char *)(pnt))[3]<<24 ) >> x2); + break; + } +#else + pix = (unsigned short)(*((unsigned int *)(pnt)) >> x2); +#endif } else if( pw >= 16 ) { +#ifdef __alpha__ /* alignment check */ + switch ((long)pnt & 3) { + case 0: pix = (unsigned short)((*((unsigned int *)(pnt)) >> x2) - & MSKBIT(np)) | (*ptmp << np); + & MSKBIT(np)) | (*ptmp << np); + break; + case 2: + pix = (unsigned short)(((*pnt | (*(pnt+1)<<16)) >> x2) + & MSKBIT(np)) | (*ptmp << np); + break; + default: + pix = (unsigned short)(((((unsigned char *)(pnt))[0]<<0 | + ((unsigned char *)(pnt))[1]<<8 | + ((unsigned char *)(pnt))[2]<<16 | + ((unsigned char *)(pnt))[3]<<24 ) >> x2) + & MSKBIT(np)) | (*ptmp << np); + break; + } +#else + pix = (unsigned short)((*((unsigned int *)(pnt)) >> x2) + & MSKBIT(np)) | (*ptmp << np); +#endif } else if( pw >= 8 ) { pix = ((*pnt >> x2) & MSKBIT(np)) | (*ptmp << np) ------------------------------------------------------------------------------- -- All SCSI disks will from now on ___ _____ be required to send an email notice 0--,| /OOOOOOO\ 24 hours prior to complete hardware failure! <_/ / /OOOOOOOOOOO\ \ \/OOOOOOOOOOOOOOO\ \ OOOOOOOOOOOOOOOOO|// Harald Koenig, \/\/\/\/\/\/\/\/\/ Inst.f.Theoret.Astrophysik // / \\ \ koenig@tat.physik.uni-tuebingen.de ^^^^^ ^^^^^