Subject: re: Crash in current
To: Robert Swindells <rjs@fdy2.demon.co.uk>
From: matthew green <mrg@eterna.com.au>
List: port-sparc
Date: 12/22/2007 14:03:16
oops, ignore the previous patch, it was wrong and old and had
purposefully introduced errors .. try this one.


.mrg.


Index: sparc/atomic/Makefile.inc
===================================================================
RCS file: /cvsroot/src/common/lib/libc/arch/sparc/atomic/Makefile.inc,v
retrieving revision 1.3
diff -p -r1.3 Makefile.inc
*** sparc/atomic/Makefile.inc	29 Nov 2007 15:29:46 -0000	1.3
--- sparc/atomic/Makefile.inc	22 Dec 2007 03:06:47 -0000
***************
*** 1,6 ****
  #	$NetBSD: Makefile.inc,v 1.3 2007/11/29 15:29:46 ad Exp $
  
! .if defined(LIB) && (${LIB} == "kern")
  
  SRCS+=	atomic_add_32_cas.c atomic_add_32_nv_cas.c atomic_and_32_cas.c \
  	atomic_and_32_nv_cas.c atomic_dec_32_cas.c atomic_dec_32_nv_cas.c \
--- 1,16 ----
  #	$NetBSD: Makefile.inc,v 1.3 2007/11/29 15:29:46 ad Exp $
  
! .include <bsd.own.mk>
! 
! .if ${MACHINE} == "sparc64"
! 
! SPARC64DIR=	${.PARSEDIR}/../../sparc64/atomic
! .PATH: ${SPARC64DIR}
! 
! .include "${SPARC64DIR}/Makefile.inc"
! 
! .else
! . if defined(LIB) && (${LIB} == "kern")
  
  SRCS+=	atomic_add_32_cas.c atomic_add_32_nv_cas.c atomic_and_32_cas.c \
  	atomic_and_32_nv_cas.c atomic_dec_32_cas.c atomic_dec_32_nv_cas.c \
*************** SRCS+=	atomic_add_32_cas.c atomic_add_32
*** 8,11 ****
--- 18,23 ----
  	atomic_or_32_nv_cas.c atomic_swap_32_cas.c \
  	atomic_cas.S membar_ops.S
  
+ . endif
+ 
  .endif
Index: sparc/atomic/atomic_op_asm.h
===================================================================
RCS file: /cvsroot/src/common/lib/libc/arch/sparc/atomic/atomic_op_asm.h,v
retrieving revision 1.2
diff -p -r1.2 atomic_op_asm.h
*** sparc/atomic/atomic_op_asm.h	29 Nov 2007 02:01:22 -0000	1.2
--- sparc/atomic/atomic_op_asm.h	22 Dec 2007 03:06:47 -0000
***************
*** 1,4 ****
! /*	$NetBSD: atomic_op_asm.h,v 1.2 2007/11/29 02:01:22 ad Exp $	*/
  
  /*-
   * Copyright (c) 2007 The NetBSD Foundation, Inc.
--- 1,4 ----
! /*	$NetBSD: atomic_op_asm.h,v 1.2 2007/11/28 17:29:32 ad Exp $	*/
  
  /*-
   * Copyright (c) 2007 The NetBSD Foundation, Inc.
***************
*** 43,54 ****
  
  #if defined(_KERNEL)
  
! #define	ATOMIC_OP_ALIAS(a,s)	STRONG_ALIAS(a,s)
  
  #else /* _KERNEL */
  
! #define	ATOMIC_OP_ALIAS(a,s)	WEAK_ALIAS(a,s)
  
  #endif /* _KERNEL */
  
  #endif /* _ATOMIC_OP_ASM_H_ */
--- 43,72 ----
  
  #if defined(_KERNEL)
  
! #define	ATOMIC_OP_ALIAS(a,s)		STRONG_ALIAS(a,s)
! 
! #ifdef __sparc64__
! #define	ATOMIC_OP_ALIAS_SIZE(a,s)	STRONG_ALIAS(a,s/**/_64)
! #else
! #define	ATOMIC_OP_ALIAS_SIZE(a,s)	STRONG_ALIAS(a,s/**/_32)
! #endif
  
  #else /* _KERNEL */
  
! #define	ATOMIC_OP_ALIAS(a,s)		WEAK_ALIAS(a,s)
! 
! #ifdef __sparc64__
! #define	ATOMIC_OP_ALIAS_SIZE(a,s)	WEAK_ALIAS(a,s/**/_64)
! #else
! #define	ATOMIC_OP_ALIAS_SIZE(a,s)	WEAK_ALIAS(a,s/**/_32)
! #endif
  
  #endif /* _KERNEL */
  
+ #ifdef __sparc64__
+ #define	STRONG_ALIAS_SIZE(a,s)		STRONG_ALIAS(a,s/**/_64)
+ #else
+ #define	STRONG_ALIAS_SIZE(a,s)		STRONG_ALIAS(a,s/**/_32)
+ #endif
+ 
  #endif /* _ATOMIC_OP_ASM_H_ */
Index: sparc64/atomic/atomic_add.S
===================================================================
RCS file: /cvsroot/src/common/lib/libc/arch/sparc64/atomic/atomic_add.S,v
retrieving revision 1.2
diff -p -r1.2 atomic_add.S
*** sparc64/atomic/atomic_add.S	28 Nov 2007 17:29:31 -0000	1.2
--- sparc64/atomic/atomic_add.S	22 Dec 2007 03:06:47 -0000
*************** ENTRY_NOPROFILE(_atomic_add_64)
*** 68,81 ****
  	retl
  	 add	%o1, %o2, %o0
  ATOMIC_OP_ALIAS(atomic_add_64,_atomic_add_64)
- ATOMIC_OP_ALIAS(atomic_add_long,_atomic_add_64)
- STRONG_ALIAS(_atomic_add_long,_atomic_add_64)
- ATOMIC_OP_ALIAS(atomic_add_ptr,_atomic_add_64)
- STRONG_ALIAS(_atomic_add_ptr,_atomic_add_64)
  
  ATOMIC_OP_ALIAS(atomic_add_64_nv,_atomic_add_64)
  STRONG_ALIAS(_atomic_add_64_nv,_atomic_add_64)
! ATOMIC_OP_ALIAS(atomic_add_long_nv,_atomic_add_64)
! STRONG_ALIAS(_atomic_add_long_nv,_atomic_add_64)
! ATOMIC_OP_ALIAS(atomic_add_ptr_nv,_atomic_add_64)
! STRONG_ALIAS(_atomic_add_ptr_nv,_atomic_add_64)
--- 68,83 ----
  	retl
  	 add	%o1, %o2, %o0
  ATOMIC_OP_ALIAS(atomic_add_64,_atomic_add_64)
  
  ATOMIC_OP_ALIAS(atomic_add_64_nv,_atomic_add_64)
  STRONG_ALIAS(_atomic_add_64_nv,_atomic_add_64)
! 
! ATOMIC_OP_ALIAS_SIZE(atomic_add_long,_atomic_add)
! STRONG_ALIAS_SIZE(_atomic_add_long,_atomic_add)
! ATOMIC_OP_ALIAS_SIZE(atomic_add_ptr,_atomic_add)
! STRONG_ALIAS_SIZE(_atomic_add_ptr,_atomic_add)
! 
! ATOMIC_OP_ALIAS_SIZE(atomic_add_long_nv,_atomic_add)
! STRONG_ALIAS_SIZE(_atomic_add_long_nv,_atomic_add)
! ATOMIC_OP_ALIAS_SIZE(atomic_add_ptr_nv,_atomic_add)
! STRONG_ALIAS_SIZE(_atomic_add_ptr_nv,_atomic_add)
Index: sparc64/atomic/atomic_and.S
===================================================================
RCS file: /cvsroot/src/common/lib/libc/arch/sparc64/atomic/atomic_and.S,v
retrieving revision 1.2
diff -p -r1.2 atomic_and.S
*** sparc64/atomic/atomic_and.S	28 Nov 2007 17:29:32 -0000	1.2
--- sparc64/atomic/atomic_and.S	22 Dec 2007 03:06:47 -0000
*************** ENTRY_NOPROFILE(_atomic_and_64)
*** 68,77 ****
  	retl
  	 and	%o1, %o2, %o0
  ATOMIC_OP_ALIAS(atomic_and_64,_atomic_and_64)
- ATOMIC_OP_ALIAS(atomic_and_ulong,_atomic_and_64)
- STRONG_ALIAS(_atomic_and_ulong,_atomic_and_64)
  
  ATOMIC_OP_ALIAS(atomic_and_64_nv,_atomic_and_64)
  STRONG_ALIAS(_atomic_and_64_nv,_atomic_and_64)
! ATOMIC_OP_ALIAS(atomic_and_ulong_nv,_atomic_and_64)
! STRONG_ALIAS(_atomic_and_ulong_nv,_atomic_and_64)
--- 68,79 ----
  	retl
  	 and	%o1, %o2, %o0
  ATOMIC_OP_ALIAS(atomic_and_64,_atomic_and_64)
  
  ATOMIC_OP_ALIAS(atomic_and_64_nv,_atomic_and_64)
  STRONG_ALIAS(_atomic_and_64_nv,_atomic_and_64)
! 
! ATOMIC_OP_ALIAS_SIZE(atomic_and_ulong,_atomic_and)
! STRONG_ALIAS_SIZE(_atomic_and_ulong,_atomic_and)
! 
! ATOMIC_OP_ALIAS_SIZE(atomic_and_ulong_nv,_atomic_and)
! STRONG_ALIAS_SIZE(_atomic_and_ulong_nv,_atomic_and)
Index: sparc64/atomic/atomic_cas.S
===================================================================
RCS file: /cvsroot/src/common/lib/libc/arch/sparc64/atomic/atomic_cas.S,v
retrieving revision 1.2
diff -p -r1.2 atomic_cas.S
*** sparc64/atomic/atomic_cas.S	28 Nov 2007 17:29:32 -0000	1.2
--- sparc64/atomic/atomic_cas.S	22 Dec 2007 03:06:47 -0000
*************** ENTRY_NOPROFILE(_atomic_cas_64)
*** 53,59 ****
  	retl
  	 mov	%o2, %o0
  ATOMIC_OP_ALIAS(atomic_cas_64,_atomic_cas_64)
! ATOMIC_OP_ALIAS(atomic_cas_ulong,_atomic_cas_64)
! STRONG_ALIAS(_atomic_cas_ulong,_atomic_cas_64)
! ATOMIC_OP_ALIAS(atomic_cas_ptr,_atomic_cas_64)
! STRONG_ALIAS(_atomic_cas_ptr,_atomic_cas_64)
--- 53,60 ----
  	retl
  	 mov	%o2, %o0
  ATOMIC_OP_ALIAS(atomic_cas_64,_atomic_cas_64)
! 
! ATOMIC_OP_ALIAS_SIZE(atomic_cas_ulong,_atomic_cas)
! STRONG_ALIAS_SIZE(_atomic_cas_ulong,_atomic_cas)
! ATOMIC_OP_ALIAS_SIZE(atomic_cas_ptr,_atomic_cas)
! STRONG_ALIAS_SIZE(_atomic_cas_ptr,_atomic_cas)
Index: sparc64/atomic/atomic_dec.S
===================================================================
RCS file: /cvsroot/src/common/lib/libc/arch/sparc64/atomic/atomic_dec.S,v
retrieving revision 1.3
diff -p -r1.3 atomic_dec.S
*** sparc64/atomic/atomic_dec.S	30 Nov 2007 17:11:48 -0000	1.3
--- sparc64/atomic/atomic_dec.S	22 Dec 2007 03:06:47 -0000
*************** ENTRY_NOPROFILE(_atomic_dec_64)
*** 68,81 ****
  	retl
  	 add	%o2, -1, %o0
  ATOMIC_OP_ALIAS(atomic_dec_64,_atomic_dec_64)
- ATOMIC_OP_ALIAS(atomic_dec_ulong,_atomic_dec_64)
- STRONG_ALIAS(_atomic_dec_ulong,_atomic_dec_64)
- ATOMIC_OP_ALIAS(atomic_dec_ptr,_atomic_dec_64)
- STRONG_ALIAS(_atomic_dec_ptr,_atomic_dec_64)
  
  ATOMIC_OP_ALIAS(atomic_dec_64_nv,_atomic_dec_64)
  STRONG_ALIAS(_atomic_dec_64_nv,_atomic_dec_64)
! ATOMIC_OP_ALIAS(atomic_dec_ulong_nv,_atomic_dec_64)
! STRONG_ALIAS(_atomic_dec_ulong_nv,_atomic_dec_64)
! ATOMIC_OP_ALIAS(atomic_dec_ptr_nv,_atomic_dec_64)
! STRONG_ALIAS(_atomic_dec_ptr_nv,_atomic_dec_64)
--- 68,83 ----
  	retl
  	 add	%o2, -1, %o0
  ATOMIC_OP_ALIAS(atomic_dec_64,_atomic_dec_64)
  
  ATOMIC_OP_ALIAS(atomic_dec_64_nv,_atomic_dec_64)
  STRONG_ALIAS(_atomic_dec_64_nv,_atomic_dec_64)
! 
! ATOMIC_OP_ALIAS_SIZE(atomic_dec_ulong,_atomic_dec)
! STRONG_ALIAS_SIZE(_atomic_dec_ulong,_atomic_dec)
! ATOMIC_OP_ALIAS_SIZE(atomic_dec_ptr,_atomic_dec)
! STRONG_ALIAS_SIZE(_atomic_dec_ptr,_atomic_dec)
! 
! ATOMIC_OP_ALIAS_SIZE(atomic_dec_ulong_nv,_atomic_dec)
! STRONG_ALIAS_SIZE(_atomic_dec_ulong_nv,_atomic_dec)
! ATOMIC_OP_ALIAS_SIZE(atomic_dec_ptr_nv,_atomic_dec)
! STRONG_ALIAS_SIZE(_atomic_dec_ptr_nv,_atomic_dec)
Index: sparc64/atomic/atomic_inc.S
===================================================================
RCS file: /cvsroot/src/common/lib/libc/arch/sparc64/atomic/atomic_inc.S,v
retrieving revision 1.2
diff -p -r1.2 atomic_inc.S
*** sparc64/atomic/atomic_inc.S	28 Nov 2007 17:29:32 -0000	1.2
--- sparc64/atomic/atomic_inc.S	22 Dec 2007 03:06:47 -0000
*************** ENTRY_NOPROFILE(_atomic_inc_64)
*** 68,81 ****
  	retl
  	 add	%o2, 1, %o0
  ATOMIC_OP_ALIAS(atomic_inc_64,_atomic_inc_64)
- ATOMIC_OP_ALIAS(atomic_inc_ulong,_atomic_inc_64)
- STRONG_ALIAS(_atomic_inc_ulong,_atomic_inc_64)
- ATOMIC_OP_ALIAS(atomic_inc_ptr,_atomic_inc_64)
- STRONG_ALIAS(_atomic_inc_ptr,_atomic_inc_64)
  
  ATOMIC_OP_ALIAS(atomic_inc_64_nv,_atomic_inc_64)
  STRONG_ALIAS(_atomic_inc_64_nv,_atomic_inc_64)
! ATOMIC_OP_ALIAS(atomic_inc_ulong_nv,_atomic_inc_64)
! STRONG_ALIAS(_atomic_inc_ulong_nv,_atomic_inc_64)
! ATOMIC_OP_ALIAS(atomic_inc_ptr_nv,_atomic_inc_64)
! STRONG_ALIAS(_atomic_inc_ptr_nv,_atomic_inc_64)
--- 68,83 ----
  	retl
  	 add	%o2, 1, %o0
  ATOMIC_OP_ALIAS(atomic_inc_64,_atomic_inc_64)
  
  ATOMIC_OP_ALIAS(atomic_inc_64_nv,_atomic_inc_64)
  STRONG_ALIAS(_atomic_inc_64_nv,_atomic_inc_64)
! 
! ATOMIC_OP_ALIAS_SIZE(atomic_inc_ulong,_atomic_inc)
! STRONG_ALIAS_SIZE(_atomic_inc_ulong,_atomic_inc)
! ATOMIC_OP_ALIAS_SIZE(atomic_inc_ptr,_atomic_inc)
! STRONG_ALIAS_SIZE(_atomic_inc_ptr,_atomic_inc)
! 
! ATOMIC_OP_ALIAS_SIZE(atomic_inc_ulong_nv,_atomic_inc)
! STRONG_ALIAS_SIZE(_atomic_inc_ulong_nv,_atomic_inc)
! ATOMIC_OP_ALIAS_SIZE(atomic_inc_ptr_nv,_atomic_inc)
! STRONG_ALIAS_SIZE(_atomic_inc_ptr_nv,_atomic_inc)
Index: sparc64/atomic/atomic_op_asm.h
===================================================================
RCS file: /cvsroot/src/common/lib/libc/arch/sparc64/atomic/atomic_op_asm.h,v
retrieving revision 1.2
diff -p -r1.2 atomic_op_asm.h
*** sparc64/atomic/atomic_op_asm.h	28 Nov 2007 17:29:32 -0000	1.2
--- sparc64/atomic/atomic_op_asm.h	22 Dec 2007 03:06:47 -0000
***************
*** 43,54 ****
  
  #if defined(_KERNEL)
  
! #define	ATOMIC_OP_ALIAS(a,s)	STRONG_ALIAS(a,s)
  
  #else /* _KERNEL */
  
! #define	ATOMIC_OP_ALIAS(a,s)	WEAK_ALIAS(a,s)
  
  #endif /* _KERNEL */
  
  #endif /* _ATOMIC_OP_ASM_H_ */
--- 43,72 ----
  
  #if defined(_KERNEL)
  
! #define	ATOMIC_OP_ALIAS(a,s)		STRONG_ALIAS(a,s)
! 
! #ifdef __sparc64__
! #define	ATOMIC_OP_ALIAS_SIZE(a,s)	STRONG_ALIAS(a,s/**/_64)
! #else
! #define	ATOMIC_OP_ALIAS_SIZE(a,s)	STRONG_ALIAS(a,s/**/_32)
! #endif
  
  #else /* _KERNEL */
  
! #define	ATOMIC_OP_ALIAS(a,s)		WEAK_ALIAS(a,s)
! 
! #ifdef __sparc64__
! #define	ATOMIC_OP_ALIAS_SIZE(a,s)	WEAK_ALIAS(a,s/**/_64)
! #else
! #define	ATOMIC_OP_ALIAS_SIZE(a,s)	WEAK_ALIAS(a,s/**/_32)
! #endif
  
  #endif /* _KERNEL */
  
+ #ifdef __sparc64__
+ #define	STRONG_ALIAS_SIZE(a,s)		STRONG_ALIAS(a,s/**/_64)
+ #else
+ #define	STRONG_ALIAS_SIZE(a,s)		STRONG_ALIAS(a,s/**/_32)
+ #endif
+ 
  #endif /* _ATOMIC_OP_ASM_H_ */
Index: sparc64/atomic/atomic_or.S
===================================================================
RCS file: /cvsroot/src/common/lib/libc/arch/sparc64/atomic/atomic_or.S,v
retrieving revision 1.2
diff -p -r1.2 atomic_or.S
*** sparc64/atomic/atomic_or.S	28 Nov 2007 17:29:33 -0000	1.2
--- sparc64/atomic/atomic_or.S	22 Dec 2007 03:06:47 -0000
*************** ENTRY_NOPROFILE(_atomic_or_64)
*** 68,77 ****
  	retl
  	 or	%o1, %o2, %o0
  ATOMIC_OP_ALIAS(atomic_or_64,_atomic_or_64)
- ATOMIC_OP_ALIAS(atomic_or_ulong,_atomic_or_64)
- STRONG_ALIAS(_atomic_or_ulong,_atomic_or_64)
  
  ATOMIC_OP_ALIAS(atomic_or_64_nv,_atomic_or_64)
  STRONG_ALIAS(_atomic_or_64_nv,_atomic_or_64)
! ATOMIC_OP_ALIAS(atomic_or_ulong_nv,_atomic_or_64)
! STRONG_ALIAS(_atomic_or_ulong_nv,_atomic_or_64)
--- 68,79 ----
  	retl
  	 or	%o1, %o2, %o0
  ATOMIC_OP_ALIAS(atomic_or_64,_atomic_or_64)
  
  ATOMIC_OP_ALIAS(atomic_or_64_nv,_atomic_or_64)
  STRONG_ALIAS(_atomic_or_64_nv,_atomic_or_64)
! 
! ATOMIC_OP_ALIAS_SIZE(atomic_or_ulong,_atomic_or)
! STRONG_ALIAS(_atomic_or_ulong,_atomic_or)
! 
! ATOMIC_OP_ALIAS_SIZE(atomic_or_ulong_nv,_atomic_or)
! STRONG_ALIAS_SIZE(_atomic_or_ulong_nv,_atomic_or)
Index: sparc64/atomic/atomic_swap.S
===================================================================
RCS file: /cvsroot/src/common/lib/libc/arch/sparc64/atomic/atomic_swap.S,v
retrieving revision 1.2
diff -p -r1.2 atomic_swap.S
*** sparc64/atomic/atomic_swap.S	28 Nov 2007 17:29:33 -0000	1.2
--- sparc64/atomic/atomic_swap.S	22 Dec 2007 03:06:47 -0000
*************** ENTRY_NOPROFILE(_atomic_swap_64)
*** 63,69 ****
  	retl
  	 mov	%o3, %o0
  ATOMIC_OP_ALIAS(atomic_swap_64,_atomic_swap_64)
! ATOMIC_OP_ALIAS(atomic_swap_ulong,_atomic_swap_64)
! STRONG_ALIAS(_atomic_swap_ulong,_atomic_swap_64)
! ATOMIC_OP_ALIAS(atomic_swap_ptr,_atomic_swap_64)
! STRONG_ALIAS(_atomic_swap_ptr,_atomic_swap_64)
--- 63,70 ----
  	retl
  	 mov	%o3, %o0
  ATOMIC_OP_ALIAS(atomic_swap_64,_atomic_swap_64)
! 
! ATOMIC_OP_ALIAS_SIZE(atomic_swap_ulong,_atomic_swap)
! STRONG_ALIAS_SIZE(_atomic_swap_ulong,_atomic_swap)
! ATOMIC_OP_ALIAS_SIZE(atomic_swap_ptr,_atomic_swap)
! STRONG_ALIAS_SIZE(_atomic_swap_ptr,_atomic_swap)