patch-2.4.4 linux/include/asm-s390x/system.h
Next file: linux/include/asm-s390x/termios.h
Previous file: linux/include/asm-s390x/spinlock.h
Back to the patch index
Back to the overall index
- Lines: 85
- Date:
Wed Apr 11 19:02:29 2001
- Orig file:
v2.4.3/linux/include/asm-s390x/system.h
- Orig date:
Tue Feb 13 14:13:44 2001
diff -u --recursive --new-file v2.4.3/linux/include/asm-s390x/system.h linux/include/asm-s390x/system.h
@@ -33,6 +33,9 @@
#define xchg(ptr,x) \
((__typeof__(*(ptr)))__xchg((unsigned long)(x),(void *)(ptr),sizeof(*(ptr))))
+extern void __misaligned_u16(void);
+extern void __misaligned_u32(void);
+extern void __misaligned_u64(void);
static inline unsigned long __xchg(unsigned long x, void * ptr, int size)
{
@@ -43,14 +46,14 @@
" nr 1,%0\n" /* isolate last 2 bits */
" xr %0,1\n" /* align ptr */
" bras 2,0f\n"
- " icm 1,8,%1\n" /* for ptr&3 == 0 */
- " stcm 0,8,%1\n"
- " icm 1,4,%1\n" /* for ptr&3 == 1 */
- " stcm 0,4,%1\n"
- " icm 1,2,%1\n" /* for ptr&3 == 2 */
- " stcm 0,2,%1\n"
- " icm 1,1,%1\n" /* for ptr&3 == 3 */
- " stcm 0,1,%1\n"
+ " icm 1,8,7(%1)\n" /* for ptr&3 == 0 */
+ " stcm 0,8,7(%1)\n"
+ " icm 1,4,7(%1)\n" /* for ptr&3 == 1 */
+ " stcm 0,4,7(%1)\n"
+ " icm 1,2,7(%1)\n" /* for ptr&3 == 2 */
+ " stcm 0,2,7(%1)\n"
+ " icm 1,1,7(%1)\n" /* for ptr&3 == 3 */
+ " stcm 0,1,7(%1)\n"
"0: sll 1,3\n"
" la 2,0(1,2)\n" /* r2 points to an icm */
" l 0,0(%0)\n" /* get fullword */
@@ -59,20 +62,21 @@
" cs 0,1,0(%0)\n"
" jl 1b\n"
" ex 0,4(2)" /* store *ptr to x */
- : "+&a" (ptr), "+m" (x) :
+ : "+&a" (ptr) : "a" (&x)
: "memory", "0", "1", "2");
+ break;
case 2:
if(((addr_t)ptr)&1)
- panic("misaligned (__u16 *) in __xchg\n");
+ __misaligned_u16();
asm volatile (
" lghi 1,2\n"
" nr 1,%0\n" /* isolate bit 2^1 */
" xr %0,1\n" /* align ptr */
" bras 2,0f\n"
- " icm 1,12,%1\n" /* for ptr&2 == 0 */
- " stcm 0,12,%1\n"
- " icm 1,3,%1\n" /* for ptr&2 == 1 */
- " stcm 0,3,%1\n"
+ " icm 1,12,6(%1)\n" /* for ptr&2 == 0 */
+ " stcm 0,12,6(%1)\n"
+ " icm 1,3,2(%1)\n" /* for ptr&2 == 1 */
+ " stcm 0,3,2(%1)\n"
"0: sll 1,2\n"
" la 2,0(1,2)\n" /* r2 points to an icm */
" l 0,0(%0)\n" /* get fullword */
@@ -81,12 +85,12 @@
" cs 0,1,0(%0)\n"
" jl 1b\n"
" ex 0,4(2)" /* store *ptr to x */
- : "+&a" (ptr), "+m" (x) :
+ : "+&a" (ptr) : "a" (&x)
: "memory", "0", "1", "2");
break;
case 4:
if(((addr_t)ptr)&3)
- panic("misaligned (__u32 *) in __xchg\n");
+ __misaligned_u32();
asm volatile (
" l 0,0(%1)\n"
"0: cs 0,%0,0(%1)\n"
@@ -97,7 +101,7 @@
break;
case 8:
if(((addr_t)ptr)&7)
- panic("misaligned (__u64 *) in __xchg\n");
+ __misaligned_u64();
asm volatile (
" lg 0,0(%1)\n"
"0: csg 0,%0,0(%1)\n"
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)