From: Andy P. <at...@us...> - 2002-04-09 17:08:06
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/s390/lib In directory usw-pr-cvs1:/tmp/cvs-serv13825/s390/lib Modified Files: Makefile checksum.c Added Files: misaligned.c Log Message: synch 2.4.15 commit 29 --- NEW FILE --- /* * arch/s390/lib/misaligned.c * S390 misalignment panic stubs * * S390 version * Copyright (C) 2001 IBM Deutschland Entwicklung GmbH, IBM Corporation * Author(s): Martin Schwidefsky (sch...@de...). * * xchg wants to panic if the pointer is not aligned. To avoid multiplying * the panic message over and over again, the panic is done in the helper * functions __misaligned_u32 and __misaligned_u16. */ #include <linux/module.h> #include <linux/kernel.h> void __misaligned_u16(void) { panic("misaligned (__u16 *) in __xchg\n"); } void __misaligned_u32(void) { panic("misaligned (__u32 *) in __xchg\n"); } EXPORT_SYMBOL(__misaligned_u16); EXPORT_SYMBOL(__misaligned_u32); Index: Makefile =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/s390/lib/Makefile,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- Makefile 25 Feb 2001 23:15:22 -0000 1.1.1.2 +++ Makefile 9 Apr 2002 17:03:17 -0000 1.2 @@ -12,7 +12,8 @@ L_TARGET = lib.a -obj-y = checksum.o delay.o memset.o strcmp.o strncpy.o uaccess.o +obj-y = checksum.o delay.o memset.o misaligned.o strcmp.o strncpy.o uaccess.o +export-objs += misaligned.o include $(TOPDIR)/Rules.make Index: checksum.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/s390/lib/checksum.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- checksum.c 14 Jan 2001 19:55:44 -0000 1.1.1.1 +++ checksum.c 9 Apr 2002 17:03:17 -0000 1.2 @@ -23,18 +23,17 @@ unsigned int csum_partial (const unsigned char *buff, int len, unsigned int sum) { + register_pair rp; /* * Experiments with ethernet and slip connections show that buff * is aligned on either a 2-byte or 4-byte boundary. */ + rp.subreg.even = (unsigned long) buff; + rp.subreg.odd = (unsigned long) len; __asm__ __volatile__ ( - " lr 2,%1\n" /* address in gpr 2 */ - " lr 3,%2\n" /* length in gpr 3 */ - "0: cksm %0,2\n" /* do checksum on longs */ + "0: cksm %0,%1\n" /* do checksum on longs */ " jo 0b\n" - : "+&d" (sum) - : "d" (buff), "d" (len) - : "cc", "2", "3" ); + : "+&d" (sum), "+&a" (rp) : : "cc" ); return sum; } @@ -43,14 +42,16 @@ */ unsigned short csum_fold(unsigned int sum) { - __asm__ __volatile__ ( - " sr 3,3\n" /* %0 = H*65536 + L */ - " lr 2,%0\n" /* %0 = H L, R2/R3 = H L / 0 0 */ - " srdl 2,16\n" /* %0 = H L, R2/R3 = 0 H / L 0 */ - " alr 2,3\n" /* %0 = H L, R2/R3 = L H / L 0 */ - " alr %0,2\n" /* %0 = H+L+C L+H */ - " srl %0,16\n" /* %0 = H+L+C */ - : "+d" (sum) : : "cc", "2", "3"); - return ((unsigned short) ~sum); + register_pair rp; + + __asm__ __volatile__ ( + " slr %N1,%N1\n" /* %0 = H L */ + " lr %1,%0\n" /* %0 = H L, %1 = H L 0 0 */ + " srdl %1,16\n" /* %0 = H L, %1 = 0 H L 0 */ + " alr %1,%N1\n" /* %0 = H L, %1 = L H L 0 */ + " alr %0,%1\n" /* %0 = H+L+C L+H */ + " srl %0,16\n" /* %0 = H+L+C */ + : "+&d" (sum), "=d" (rp) : : "cc" ); + return ((unsigned short) ~sum); } |