Fri Feb 21 10:27:34 2014 UTC ()
Add missing __sync_lock_test_and_set_* aliases for PR lib/48601


(martin)
diff -r1.4 -r1.5 src/common/lib/libc/atomic/atomic_swap_32_cas.c
diff -r1.5 -r1.6 src/common/lib/libc/atomic/atomic_swap_64_cas.c

cvs diff -r1.4 -r1.5 src/common/lib/libc/atomic/atomic_swap_32_cas.c (expand / switch to unified diff)

--- src/common/lib/libc/atomic/atomic_swap_32_cas.c 2008/04/28 20:22:53 1.4
+++ src/common/lib/libc/atomic/atomic_swap_32_cas.c 2014/02/21 10:27:34 1.5
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: atomic_swap_32_cas.c,v 1.4 2008/04/28 20:22:53 martin Exp $ */ 1/* $NetBSD: atomic_swap_32_cas.c,v 1.5 2014/02/21 10:27:34 martin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2007 The NetBSD Foundation, Inc. 4 * Copyright (c) 2007 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe. 8 * by Jason R. Thorpe.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -40,21 +40,22 @@ atomic_swap_32(volatile uint32_t *addr,  @@ -40,21 +40,22 @@ atomic_swap_32(volatile uint32_t *addr,
40 40
41 do { 41 do {
42 old = *addr; 42 old = *addr;
43 } while (atomic_cas_32(addr, old, new) != old); 43 } while (atomic_cas_32(addr, old, new) != old);
44 44
45 return (old); 45 return (old);
46} 46}
47 47
48#undef atomic_swap_32 48#undef atomic_swap_32
49atomic_op_alias(atomic_swap_32,_atomic_swap_32) 49atomic_op_alias(atomic_swap_32,_atomic_swap_32)
50#undef atomic_swap_uint 50#undef atomic_swap_uint
51atomic_op_alias(atomic_swap_uint,_atomic_swap_32) 51atomic_op_alias(atomic_swap_uint,_atomic_swap_32)
52__strong_alias(_atomic_swap_uint,_atomic_swap_32) 52__strong_alias(_atomic_swap_uint,_atomic_swap_32)
 53__strong_alias(__sync_lock_test_and_set_4,_atomic_swap_32)
53#if !defined(_LP64) 54#if !defined(_LP64)
54#undef atomic_swap_ulong 55#undef atomic_swap_ulong
55atomic_op_alias(atomic_swap_ulong,_atomic_swap_32) 56atomic_op_alias(atomic_swap_ulong,_atomic_swap_32)
56__strong_alias(_atomic_swap_ulong,_atomic_swap_32) 57__strong_alias(_atomic_swap_ulong,_atomic_swap_32)
57#undef atomic_swap_ptr 58#undef atomic_swap_ptr
58atomic_op_alias(atomic_swap_ptr,_atomic_swap_32) 59atomic_op_alias(atomic_swap_ptr,_atomic_swap_32)
59__strong_alias(_atomic_swap_ptr,_atomic_swap_32) 60__strong_alias(_atomic_swap_ptr,_atomic_swap_32)
60#endif /* _LP64 */ 61#endif /* _LP64 */

cvs diff -r1.5 -r1.6 src/common/lib/libc/atomic/atomic_swap_64_cas.c (expand / switch to unified diff)

--- src/common/lib/libc/atomic/atomic_swap_64_cas.c 2008/04/28 20:22:53 1.5
+++ src/common/lib/libc/atomic/atomic_swap_64_cas.c 2014/02/21 10:27:34 1.6
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: atomic_swap_64_cas.c,v 1.5 2008/04/28 20:22:53 martin Exp $ */ 1/* $NetBSD: atomic_swap_64_cas.c,v 1.6 2014/02/21 10:27:34 martin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2007 The NetBSD Foundation, Inc. 4 * Copyright (c) 2007 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe. 8 * by Jason R. Thorpe.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -43,19 +43,20 @@ atomic_swap_64(volatile uint64_t *addr,  @@ -43,19 +43,20 @@ atomic_swap_64(volatile uint64_t *addr,
43 do { 43 do {
44 old = *addr; 44 old = *addr;
45 } while (atomic_cas_64(addr, old, new) != old); 45 } while (atomic_cas_64(addr, old, new) != old);
46 46
47 return (old); 47 return (old);
48} 48}
49 49
50#undef atomic_swap_64 50#undef atomic_swap_64
51atomic_op_alias(atomic_swap_64,_atomic_swap_64) 51atomic_op_alias(atomic_swap_64,_atomic_swap_64)
52#if defined(_LP64) 52#if defined(_LP64)
53#undef atomic_swap_ulong 53#undef atomic_swap_ulong
54atomic_op_alias(atomic_swap_ulong,_atomic_swap_64) 54atomic_op_alias(atomic_swap_ulong,_atomic_swap_64)
55__strong_alias(_atomic_swap_ulong,_atomic_swap_64) 55__strong_alias(_atomic_swap_ulong,_atomic_swap_64)
 56__strong_alias(__sync_lock_test_and_set_8,_atomic_swap_64)
56#undef atomic_swap_ptr 57#undef atomic_swap_ptr
57atomic_op_alias(atomic_swap_ptr,_atomic_swap_64) 58atomic_op_alias(atomic_swap_ptr,_atomic_swap_64)
58__strong_alias(_atomic_swap_ptr,_atomic_swap_64) 59__strong_alias(_atomic_swap_ptr,_atomic_swap_64)
59#endif /* _LP64 */ 60#endif /* _LP64 */
60 61
61#endif 62#endif