Fri Nov 29 22:55:34 2019 UTC ()
Nix now-unused definitions of MUTEX_GIVE/MUTEX_RECEIVE.


(riastradh)
diff -r1.5 -r1.6 src/sys/arch/alpha/include/mutex.h
diff -r1.20 -r1.21 src/sys/arch/arm/include/mutex.h
diff -r1.4 -r1.5 src/sys/arch/ia64/include/mutex.h
diff -r1.8 -r1.9 src/sys/arch/m68k/include/mutex.h
diff -r1.7 -r1.8 src/sys/arch/mips/include/mutex.h
diff -r1.1 -r1.2 src/sys/arch/or1k/include/mutex.h
diff -r1.5 -r1.6 src/sys/arch/powerpc/include/mutex.h
diff -r1.2 -r1.3 src/sys/arch/riscv/include/mutex.h
diff -r1.9 -r1.10 src/sys/arch/sh3/include/mutex.h
diff -r1.10 -r1.11 src/sys/arch/sparc/include/mutex.h
diff -r1.5 -r1.6 src/sys/arch/sparc64/include/mutex.h
diff -r1.3 -r1.4 src/sys/arch/usermode/include/mutex.h
diff -r1.14 -r1.15 src/sys/arch/vax/include/mutex.h
diff -r1.6 -r1.7 src/sys/arch/x86/include/mutex.h

cvs diff -r1.5 -r1.6 src/sys/arch/alpha/include/mutex.h (expand / switch to unified diff)

--- src/sys/arch/alpha/include/mutex.h 2019/11/29 20:05:07 1.5
+++ src/sys/arch/alpha/include/mutex.h 2019/11/29 22:55:33 1.6
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: mutex.h,v 1.5 2019/11/29 20:05:07 riastradh Exp $ */ 1/* $NetBSD: mutex.h,v 1.6 2019/11/29 22:55:33 riastradh Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2002, 2006, 2007 The NetBSD Foundation, Inc. 4 * Copyright (c) 2002, 2006, 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 and Andrew Doran. 8 * by Jason R. Thorpe and Andrew Doran.
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.
@@ -50,23 +50,20 @@ struct kmutex { @@ -50,23 +50,20 @@ struct kmutex {
50 volatile uint16_t mtxs_unused; 50 volatile uint16_t mtxs_unused;
51 } s; 51 } s;
52 } u; 52 } u;
53 __cpu_simple_lock_t mtx_lock; 53 __cpu_simple_lock_t mtx_lock;
54}; 54};
55 55
56#define mtx_owner u.mtxa_owner 56#define mtx_owner u.mtxa_owner
57#define mtx_flags u.s.mtxs_flags 57#define mtx_flags u.s.mtxs_flags
58#define mtx_ipl u.s.mtxs_ipl 58#define mtx_ipl u.s.mtxs_ipl
59 59
60#define __HAVE_SIMPLE_MUTEXES 1 60#define __HAVE_SIMPLE_MUTEXES 1
61#define __HAVE_MUTEX_STUBS 1 61#define __HAVE_MUTEX_STUBS 1
62 62
63#define MUTEX_RECEIVE(mtx) __asm __volatile("mb" : : : "memory") 
64#define MUTEX_GIVE(mtx) __asm __volatile("mb" : : : "memory") 
65 
66#define MUTEX_CAS(p, o, n) _lock_cas((p), (o), (n)) 63#define MUTEX_CAS(p, o, n) _lock_cas((p), (o), (n))
67 64
68int _lock_cas(volatile uintptr_t *, uintptr_t, uintptr_t); 65int _lock_cas(volatile uintptr_t *, uintptr_t, uintptr_t);
69 66
70#endif /* __MUTEX_PRIVATE */ 67#endif /* __MUTEX_PRIVATE */
71 68
72#endif /* _ALPHA_MUTEX_H_ */ 69#endif /* _ALPHA_MUTEX_H_ */

cvs diff -r1.20 -r1.21 src/sys/arch/arm/include/mutex.h (expand / switch to unified diff)

--- src/sys/arch/arm/include/mutex.h 2015/02/25 13:52:42 1.20
+++ src/sys/arch/arm/include/mutex.h 2019/11/29 22:55:33 1.21
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: mutex.h,v 1.20 2015/02/25 13:52:42 joerg Exp $ */ 1/* $NetBSD: mutex.h,v 1.21 2019/11/29 22:55:33 riastradh Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2002, 2007 The NetBSD Foundation, Inc. 4 * Copyright (c) 2002, 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 and Andrew Doran. 8 * by Jason R. Thorpe and Andrew Doran.
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.
@@ -74,47 +74,23 @@ struct kmutex { @@ -74,47 +74,23 @@ struct kmutex {
74 } u; 74 } u;
75}; 75};
76 76
77#define mtx_owner u.mtxa_owner 77#define mtx_owner u.mtxa_owner
78#define mtx_ipl u.s.mtxs_ipl 78#define mtx_ipl u.s.mtxs_ipl
79#define mtx_lock u.s.mtxs_lock 79#define mtx_lock u.s.mtxs_lock
80 80
81#if 0 81#if 0
82#define __HAVE_MUTEX_STUBS 1 82#define __HAVE_MUTEX_STUBS 1
83#define __HAVE_SPIN_MUTEX_STUBS 1 83#define __HAVE_SPIN_MUTEX_STUBS 1
84#endif 84#endif
85#define __HAVE_SIMPLE_MUTEXES 1 85#define __HAVE_SIMPLE_MUTEXES 1
86 86
87/* 
88 * MUTEX_{GIVE,RECEIVE}: no memory barrier is required in the UP case; 
89 * we're synchronizing against interrupts, not multiple processors. 
90 */ 
91#ifdef MULTIPROCESSOR 
92#ifdef _ARM_ARCH_7 
93#define MUTEX_RECEIVE(mtx) __asm __volatile("dmb" ::: "memory") 
94#else 
95#define MUTEX_RECEIVE(mtx) membar_consumer() 
96#endif 
97#else 
98#define MUTEX_RECEIVE(mtx) /* nothing */ 
99#endif 
100 
101#ifdef MULTIPROCESSOR 
102#ifdef _ARM_ARCH_7 
103#define MUTEX_GIVE(mtx) __asm __volatile("dsb" ::: "memory") 
104#else 
105#define MUTEX_GIVE(mtx) membar_producer() 
106#endif 
107#else 
108#define MUTEX_GIVE(mtx) /* nothing */ 
109#endif 
110 
111#define MUTEX_CAS(p, o, n) \ 87#define MUTEX_CAS(p, o, n) \
112 (atomic_cas_ulong((volatile unsigned long *)(p), (o), (n)) == (o)) 88 (atomic_cas_ulong((volatile unsigned long *)(p), (o), (n)) == (o))
113#ifdef MULTIPROCESSOR 89#ifdef MULTIPROCESSOR
114#define MUTEX_SMT_PAUSE() __asm __volatile("wfe") 90#define MUTEX_SMT_PAUSE() __asm __volatile("wfe")
115#define MUTEX_SMT_WAKE() __asm __volatile("sev") 91#define MUTEX_SMT_WAKE() __asm __volatile("sev")
116#endif 92#endif
117 93
118#endif /* __MUTEX_PRIVATE */ 94#endif /* __MUTEX_PRIVATE */
119 95
120#endif /* _ARM_MUTEX_H_ */ 96#endif /* _ARM_MUTEX_H_ */

cvs diff -r1.4 -r1.5 src/sys/arch/ia64/include/mutex.h (expand / switch to unified diff)

--- src/sys/arch/ia64/include/mutex.h 2009/07/20 04:41:37 1.4
+++ src/sys/arch/ia64/include/mutex.h 2019/11/29 22:55:33 1.5
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: mutex.h,v 1.4 2009/07/20 04:41:37 kiyohara Exp $ */ 1/* $NetBSD: mutex.h,v 1.5 2019/11/29 22:55:33 riastradh Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2008 The NetBSD Foundation, Inc. 4 * Copyright (c) 2008 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 Takayoshi Kochi. 8 * by Takayoshi Kochi.
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.
@@ -46,29 +46,19 @@ struct kmutex { @@ -46,29 +46,19 @@ struct kmutex {
46 ipl_cookie_t mtx_ipl; 46 ipl_cookie_t mtx_ipl;
47 __cpu_simple_lock_t mtx_lock; 47 __cpu_simple_lock_t mtx_lock;
48}; 48};
49 49
50 50
51/* XXX when we implement mutex_enter()/mutex_exit(), uncomment this 51/* XXX when we implement mutex_enter()/mutex_exit(), uncomment this
52#define __HAVE_MUTEX_STUBS 1 52#define __HAVE_MUTEX_STUBS 1
53*/ 53*/
54/* XXX when we implement mutex_spin_enter()/mutex_spin_exit(), uncomment this 54/* XXX when we implement mutex_spin_enter()/mutex_spin_exit(), uncomment this
55#define __HAVE_SPIN_MUTEX_STUBS 1 55#define __HAVE_SPIN_MUTEX_STUBS 1
56*/ 56*/
57#define __HAVE_SIMPLE_MUTEXES 1 57#define __HAVE_SIMPLE_MUTEXES 1
58 58
59/* 
60 * MUTEX_RECEIVE: no memory barrier required, atomic_cas implies a load fence. 
61 */ 
62#define MUTEX_RECEIVE(mtx) /* nothing */ 
63 
64/* 
65 * MUTEX_GIVE: no memory barrier required, as _lock_cas() will take care of it. 
66 */ 
67#define MUTEX_GIVE(mtx) /* nothing */ 
68 
69#define MUTEX_CAS(ptr, old, new) \ 59#define MUTEX_CAS(ptr, old, new) \
70 (atomic_cas_ulong((volatile unsigned long *)(ptr), (old), (new)) == (old)) 60 (atomic_cas_ulong((volatile unsigned long *)(ptr), (old), (new)) == (old))
71 61
72#endif /* __MUTEX_PRIVATE */ 62#endif /* __MUTEX_PRIVATE */
73 63
74#endif /* _IA64_MUTEX_H_ */ 64#endif /* _IA64_MUTEX_H_ */

cvs diff -r1.8 -r1.9 src/sys/arch/m68k/include/mutex.h (expand / switch to unified diff)

--- src/sys/arch/m68k/include/mutex.h 2019/11/29 20:05:49 1.8
+++ src/sys/arch/m68k/include/mutex.h 2019/11/29 22:55:33 1.9
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: mutex.h,v 1.8 2019/11/29 20:05:49 riastradh Exp $ */ 1/* $NetBSD: mutex.h,v 1.9 2019/11/29 22:55:33 riastradh Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2002, 2007 The NetBSD Foundation, Inc. 4 * Copyright (c) 2002, 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 and Andrew Doran. 8 * by Jason R. Thorpe and Andrew Doran.
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.
@@ -52,22 +52,19 @@ struct kmutex { @@ -52,22 +52,19 @@ struct kmutex {
52 __cpu_simple_lock_t mtxs_lock; /* 2 */ 52 __cpu_simple_lock_t mtxs_lock; /* 2 */
53 uint8_t mtxs_unused; /* 3 */ 53 uint8_t mtxs_unused; /* 3 */
54 } s; 54 } s;
55 } u; 55 } u;
56}; 56};
57 57
58#define mtx_owner u.mtxu_owner 58#define mtx_owner u.mtxu_owner
59#define mtx_ipl u.s.mtxs_ipl 59#define mtx_ipl u.s.mtxs_ipl
60#define mtx_lock u.s.mtxs_lock 60#define mtx_lock u.s.mtxs_lock
61 61
62#define __HAVE_SIMPLE_MUTEXES 1 62#define __HAVE_SIMPLE_MUTEXES 1
63#define __HAVE_MUTEX_STUBS 1 63#define __HAVE_MUTEX_STUBS 1
64 64
65#define MUTEX_RECEIVE(mtx) __insn_barrier() 
66#define MUTEX_GIVE(mtx) __insn_barrier() 
67 
68#define MUTEX_CAS(p, o, n) (atomic_cas_uint((p), (o), (n)) == (o)) 65#define MUTEX_CAS(p, o, n) (atomic_cas_uint((p), (o), (n)) == (o))
69 66
70#endif /* __MUTEX_PRIVATE */ 67#endif /* __MUTEX_PRIVATE */
71 68
72#endif /* _M68K_MUTEX_H_ */ 69#endif /* _M68K_MUTEX_H_ */
73 70

cvs diff -r1.7 -r1.8 src/sys/arch/mips/include/mutex.h (expand / switch to unified diff)

--- src/sys/arch/mips/include/mutex.h 2011/02/20 07:45:47 1.7
+++ src/sys/arch/mips/include/mutex.h 2019/11/29 22:55:33 1.8
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: mutex.h,v 1.7 2011/02/20 07:45:47 matt Exp $ */ 1/* $NetBSD: mutex.h,v 1.8 2019/11/29 22:55:33 riastradh Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2002, 2007 The NetBSD Foundation, Inc. 4 * Copyright (c) 2002, 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 and Andrew Doran. 8 * by Jason R. Thorpe and Andrew Doran.
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.
@@ -45,23 +45,20 @@ struct kmutex { @@ -45,23 +45,20 @@ struct kmutex {
45#include <machine/lock.h> 45#include <machine/lock.h>
46#endif 46#endif
47 47
48struct kmutex { 48struct kmutex {
49 volatile uintptr_t mtx_owner; 49 volatile uintptr_t mtx_owner;
50 ipl_cookie_t mtx_ipl; 50 ipl_cookie_t mtx_ipl;
51 __cpu_simple_lock_t mtx_lock; 51 __cpu_simple_lock_t mtx_lock;
52}; 52};
53 53
54#define __HAVE_SIMPLE_MUTEXES 1 54#define __HAVE_SIMPLE_MUTEXES 1
55#define __HAVE_MUTEX_STUBS 1 55#define __HAVE_MUTEX_STUBS 1
56#define __HAVE_SPIN_MUTEX_STUBS 1 56#define __HAVE_SPIN_MUTEX_STUBS 1
57 57
58#define MUTEX_RECEIVE(mtx) membar_enter() 
59#define MUTEX_GIVE(mtx) membar_exit() 
60 
61#define MUTEX_CAS(p, o, n) \ 58#define MUTEX_CAS(p, o, n) \
62 (atomic_cas_ulong((volatile u_long *)(p), (o), (n)) == (o)) 59 (atomic_cas_ulong((volatile u_long *)(p), (o), (n)) == (o))
63 60
64#endif /* __MUTEX_PRIVATE */ 61#endif /* __MUTEX_PRIVATE */
65 62
66#endif /* _MIPS_MUTEX_H_ */ 63#endif /* _MIPS_MUTEX_H_ */
67 64

cvs diff -r1.1 -r1.2 src/sys/arch/or1k/include/mutex.h (expand / switch to unified diff)

--- src/sys/arch/or1k/include/mutex.h 2014/09/03 19:34:26 1.1
+++ src/sys/arch/or1k/include/mutex.h 2019/11/29 22:55:33 1.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: mutex.h,v 1.1 2014/09/03 19:34:26 matt Exp $ */ 1/* $NetBSD: mutex.h,v 1.2 2019/11/29 22:55:33 riastradh Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2002, 2007 The NetBSD Foundation, Inc. 4 * Copyright (c) 2002, 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 and Andrew Doran. 8 * by Jason R. Thorpe and Andrew Doran.
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.
@@ -60,38 +60,19 @@ struct kmutex { @@ -60,38 +60,19 @@ struct kmutex {
60 } u; 60 } u;
61}; 61};
62 62
63#define mtx_owner u.mtxa_owner 63#define mtx_owner u.mtxa_owner
64#define mtx_ipl u.s.mtxs_ipl 64#define mtx_ipl u.s.mtxs_ipl
65#define mtx_lock u.s.mtxs_lock 65#define mtx_lock u.s.mtxs_lock
66 66
67#if 0 67#if 0
68#define __HAVE_MUTEX_STUBS 1 68#define __HAVE_MUTEX_STUBS 1
69#define __HAVE_SPIN_MUTEX_STUBS 1 69#define __HAVE_SPIN_MUTEX_STUBS 1
70#endif 70#endif
71#define __HAVE_SIMPLE_MUTEXES 1 71#define __HAVE_SIMPLE_MUTEXES 1
72 72
73/* 
74 * MUTEX_RECEIVE: no memory barrier required; we're synchronizing against 
75 * interrupts, not multiple processors. 
76 */ 
77#ifdef MULTIPROCESSOR 
78#define MUTEX_RECEIVE(mtx) membar_consumer() 
79#else 
80#define MUTEX_RECEIVE(mtx) /* nothing */ 
81#endif 
82 
83/* 
84 * MUTEX_GIVE: no memory barrier required; same reason. 
85 */ 
86#ifdef MULTIPROCESSOR 
87#define MUTEX_GIVE(mtx) membar_producer() 
88#else 
89#define MUTEX_GIVE(mtx) /* nothing */ 
90#endif 
91 
92#define MUTEX_CAS(p, o, n) \ 73#define MUTEX_CAS(p, o, n) \
93 (atomic_cas_ulong((volatile unsigned long *)(p), (o), (n)) == (o)) 74 (atomic_cas_ulong((volatile unsigned long *)(p), (o), (n)) == (o))
94 75
95#endif /* __MUTEX_PRIVATE */ 76#endif /* __MUTEX_PRIVATE */
96 77
97#endif /* _OR1K_MUTEX_H_ */ 78#endif /* _OR1K_MUTEX_H_ */

cvs diff -r1.5 -r1.6 src/sys/arch/powerpc/include/mutex.h (expand / switch to unified diff)

--- src/sys/arch/powerpc/include/mutex.h 2019/11/29 20:05:59 1.5
+++ src/sys/arch/powerpc/include/mutex.h 2019/11/29 22:55:34 1.6
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: mutex.h,v 1.5 2019/11/29 20:05:59 riastradh Exp $ */ 1/* $NetBSD: mutex.h,v 1.6 2019/11/29 22:55:34 riastradh Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2002, 2007 The NetBSD Foundation, Inc. 4 * Copyright (c) 2002, 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 and Andrew Doran. 8 * by Jason R. Thorpe and Andrew Doran.
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.
@@ -51,23 +51,20 @@ struct kmutex { @@ -51,23 +51,20 @@ struct kmutex {
51 } p; 51 } p;
52 } u; 52 } u;
53}; 53};
54 54
55#ifdef __MUTEX_PRIVATE 55#ifdef __MUTEX_PRIVATE
56 56
57#define mtx_owner u.m.mtxm_owner 57#define mtx_owner u.m.mtxm_owner
58#define mtx_ipl u.m.mtxm_ipl 58#define mtx_ipl u.m.mtxm_ipl
59#define mtx_lock u.m.mtxm_lock 59#define mtx_lock u.m.mtxm_lock
60 60
61#define __HAVE_SIMPLE_MUTEXES 1 61#define __HAVE_SIMPLE_MUTEXES 1
62#define __HAVE_MUTEX_STUBS 1 62#define __HAVE_MUTEX_STUBS 1
63 63
64#define MUTEX_RECEIVE(mtx) __asm __volatile("isync" ::: "memory") 
65#define MUTEX_GIVE(mtx) __asm __volatile("sync" ::: "memory") 
66 
67#define MUTEX_CAS(p, o, n) _lock_cas((p), (o), (n)) 64#define MUTEX_CAS(p, o, n) _lock_cas((p), (o), (n))
68 65
69int _lock_cas(volatile uintptr_t *, uintptr_t, uintptr_t); 66int _lock_cas(volatile uintptr_t *, uintptr_t, uintptr_t);
70 67
71#endif /* __MUTEX_PRIVATE */ 68#endif /* __MUTEX_PRIVATE */
72 69
73#endif /* _POWERPC_MUTEX_H_ */ 70#endif /* _POWERPC_MUTEX_H_ */

cvs diff -r1.2 -r1.3 src/sys/arch/riscv/include/mutex.h (expand / switch to unified diff)

--- src/sys/arch/riscv/include/mutex.h 2019/06/01 12:42:28 1.2
+++ src/sys/arch/riscv/include/mutex.h 2019/11/29 22:55:34 1.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: mutex.h,v 1.2 2019/06/01 12:42:28 maxv Exp $ */ 1/* $NetBSD: mutex.h,v 1.3 2019/11/29 22:55:34 riastradh Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2002, 2007 The NetBSD Foundation, Inc. 4 * Copyright (c) 2002, 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 and Andrew Doran. 8 * by Jason R. Thorpe and Andrew Doran.
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.
@@ -103,38 +103,19 @@ static inline void @@ -103,38 +103,19 @@ static inline void
103riscv_mutex_spinbit_lock_unlock(kmutex_t *__mtx) 103riscv_mutex_spinbit_lock_unlock(kmutex_t *__mtx)
104{ 104{
105 __asm __volatile( 105 __asm __volatile(
106 "amoand" MTX_ASMOP_SFX ".rl\tx0, %0, (%1)" 106 "amoand" MTX_ASMOP_SFX ".rl\tx0, %0, (%1)"
107 :: "r"(~MTX_LOCK), "r"(__mtx)); 107 :: "r"(~MTX_LOCK), "r"(__mtx));
108} 108}
109 109
110#if 0 110#if 0
111#define __HAVE_MUTEX_STUBS 1 111#define __HAVE_MUTEX_STUBS 1
112#define __HAVE_SPIN_MUTEX_STUBS 1 112#define __HAVE_SPIN_MUTEX_STUBS 1
113#endif 113#endif
114#define __HAVE_SIMPLE_MUTEXES 1 114#define __HAVE_SIMPLE_MUTEXES 1
115 115
116/* 
117 * MUTEX_RECEIVE: no memory barrier required; we're synchronizing against 
118 * interrupts, not multiple processors. 
119 */ 
120#ifdef MULTIPROCESSOR 
121#define MUTEX_RECEIVE(mtx) membar_consumer() 
122#else 
123#define MUTEX_RECEIVE(mtx) /* nothing */ 
124#endif 
125 
126/* 
127 * MUTEX_GIVE: no memory barrier required; same reason. 
128 */ 
129#ifdef MULTIPROCESSOR 
130#define MUTEX_GIVE(mtx) membar_producer() 
131#else 
132#define MUTEX_GIVE(mtx) /* nothing */ 
133#endif 
134 
135#define MUTEX_CAS(p, o, n) \ 116#define MUTEX_CAS(p, o, n) \
136 (atomic_cas_ulong((volatile unsigned long *)(p), (o), (n)) == (o)) 117 (atomic_cas_ulong((volatile unsigned long *)(p), (o), (n)) == (o))
137 118
138#endif /* __MUTEX_PRIVATE */ 119#endif /* __MUTEX_PRIVATE */
139 120
140#endif /* _RISCV_MUTEX_H_ */ 121#endif /* _RISCV_MUTEX_H_ */

cvs diff -r1.9 -r1.10 src/sys/arch/sh3/include/mutex.h (expand / switch to unified diff)

--- src/sys/arch/sh3/include/mutex.h 2008/04/28 20:23:35 1.9
+++ src/sys/arch/sh3/include/mutex.h 2019/11/29 22:55:34 1.10
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: mutex.h,v 1.9 2008/04/28 20:23:35 martin Exp $ */ 1/* $NetBSD: mutex.h,v 1.10 2019/11/29 22:55:34 riastradh Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2002, 2007 The NetBSD Foundation, Inc. 4 * Copyright (c) 2002, 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 and Andrew Doran. 8 * by Jason R. Thorpe and Andrew Doran.
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.
@@ -52,31 +52,20 @@ struct kmutex { @@ -52,31 +52,20 @@ struct kmutex {
52 __cpu_simple_lock_t mtxs_lock; 52 __cpu_simple_lock_t mtxs_lock;
53 volatile uint8_t mtxs_unused; 53 volatile uint8_t mtxs_unused;
54 } s; 54 } s;
55 } u; 55 } u;
56}; 56};
57 57
58#define mtx_owner u.mtxa_owner 58#define mtx_owner u.mtxa_owner
59#define mtx_ipl u.s.mtxs_ipl 59#define mtx_ipl u.s.mtxs_ipl
60#define mtx_lock u.s.mtxs_lock 60#define mtx_lock u.s.mtxs_lock
61 61
62#define __HAVE_SIMPLE_MUTEXES 1 62#define __HAVE_SIMPLE_MUTEXES 1
63#define __HAVE_MUTEX_STUBS 1 63#define __HAVE_MUTEX_STUBS 1
64 64
65/* 
66 * MUTEX_RECEIVE: no memory barrier required; we're synchronizing against 
67 * interrupts, not multiple processors. 
68 */ 
69#define MUTEX_RECEIVE(mtx) /* nothing */ 
70 
71/* 
72 * MUTEX_GIVE: no memory barrier required; same reason. 
73 */ 
74#define MUTEX_GIVE(mtx) /* nothing */ 
75 
76uintptr_t _lock_cas(volatile uintptr_t *, uintptr_t, uintptr_t); 65uintptr_t _lock_cas(volatile uintptr_t *, uintptr_t, uintptr_t);
77 66
78#define MUTEX_CAS(p, o, n) (_lock_cas((p), (o), (n)) == (o)) 67#define MUTEX_CAS(p, o, n) (_lock_cas((p), (o), (n)) == (o))
79 68
80#endif /* __MUTEX_PRIVATE */ 69#endif /* __MUTEX_PRIVATE */
81 70
82#endif /* _SH3_MUTEX_H_ */ 71#endif /* _SH3_MUTEX_H_ */

cvs diff -r1.10 -r1.11 src/sys/arch/sparc/include/mutex.h (expand / switch to unified diff)

--- src/sys/arch/sparc/include/mutex.h 2008/04/28 20:23:36 1.10
+++ src/sys/arch/sparc/include/mutex.h 2019/11/29 22:55:34 1.11
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: mutex.h,v 1.10 2008/04/28 20:23:36 martin Exp $ */ 1/* $NetBSD: mutex.h,v 1.11 2019/11/29 22:55:34 riastradh Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2002, 2006 The NetBSD Foundation, Inc. 4 * Copyright (c) 2002, 2006 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 and Andrew Doran. 8 * by Jason R. Thorpe and Andrew Doran.
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.
@@ -48,25 +48,22 @@ struct kmutex { @@ -48,25 +48,22 @@ struct kmutex {
48 } s; 48 } s;
49#endif 49#endif
50 } u; 50 } u;
51}; 51};
52 52
53#ifdef __MUTEX_PRIVATE 53#ifdef __MUTEX_PRIVATE
54 54
55#define mtx_owner u.mtxa_owner 55#define mtx_owner u.mtxa_owner
56#define mtx_ipl u.s.mtxs_ipl 56#define mtx_ipl u.s.mtxs_ipl
57#define mtx_lock u.s.mtxs_lock 57#define mtx_lock u.s.mtxs_lock
58 58
59#define __HAVE_SIMPLE_MUTEXES 1 59#define __HAVE_SIMPLE_MUTEXES 1
60 60
61#define MUTEX_RECEIVE(mtx) /* nothing */ 
62#define MUTEX_GIVE(mtx) /* nothing */ 
63 
64#define MUTEX_CAS(p, o, n) \ 61#define MUTEX_CAS(p, o, n) \
65 (_atomic_cas_ulong((volatile unsigned long *)(p), (o), (n)) == (o)) 62 (_atomic_cas_ulong((volatile unsigned long *)(p), (o), (n)) == (o))
66 63
67unsigned long _atomic_cas_ulong(volatile unsigned long *, 64unsigned long _atomic_cas_ulong(volatile unsigned long *,
68 unsigned long, unsigned long); 65 unsigned long, unsigned long);
69 66
70#endif /* __MUTEX_PRIVATE */ 67#endif /* __MUTEX_PRIVATE */
71 68
72#endif /* _SPARC_MUTEX_H_ */ 69#endif /* _SPARC_MUTEX_H_ */

cvs diff -r1.5 -r1.6 src/sys/arch/sparc64/include/mutex.h (expand / switch to unified diff)

--- src/sys/arch/sparc64/include/mutex.h 2019/11/29 20:06:34 1.5
+++ src/sys/arch/sparc64/include/mutex.h 2019/11/29 22:55:34 1.6
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: mutex.h,v 1.5 2019/11/29 20:06:34 riastradh Exp $ */ 1/* $NetBSD: mutex.h,v 1.6 2019/11/29 22:55:34 riastradh Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2002, 2007 The NetBSD Foundation, Inc. 4 * Copyright (c) 2002, 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 and Andrew Doran. 8 * by Jason R. Thorpe and Andrew Doran.
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.
@@ -45,31 +45,20 @@ struct kmutex { @@ -45,31 +45,20 @@ struct kmutex {
45#endif 45#endif
46 } u; 46 } u;
47}; 47};
48 48
49#ifdef __MUTEX_PRIVATE 49#ifdef __MUTEX_PRIVATE
50 50
51#define mtx_owner u.mtxa_owner 51#define mtx_owner u.mtxa_owner
52#define mtx_ipl u.s.mtxs_ipl 52#define mtx_ipl u.s.mtxs_ipl
53#define mtx_lock u.s.mtxs_lock 53#define mtx_lock u.s.mtxs_lock
54 54
55#define __HAVE_MUTEX_STUBS 1 55#define __HAVE_MUTEX_STUBS 1
56#define __HAVE_SIMPLE_MUTEXES 1 56#define __HAVE_SIMPLE_MUTEXES 1
57 57
58/* 
59 * XXX Should this be LoadLoad|LoadStore, or does the assumption of a 
60 * preceding atomic r/m/w operation obviate the need for that? 
61 */ 
62#define MUTEX_RECEIVE(mtx) __asm __volatile("membar #LoadLoad" : : : "memory") 
63 
64/* 
65 * MUTEX_GIVE: no memory barrier required, as _lock_cas() will take care of it. 
66 */ 
67#define MUTEX_GIVE(mtx) __insn_barrier() 
68 
69#define MUTEX_CAS(p, o, n) _lock_cas((p), (o), (n)) 58#define MUTEX_CAS(p, o, n) _lock_cas((p), (o), (n))
70 59
71int _lock_cas(volatile uintptr_t *, uintptr_t, uintptr_t); 60int _lock_cas(volatile uintptr_t *, uintptr_t, uintptr_t);
72 61
73#endif /* __MUTEX_PRIVATE */ 62#endif /* __MUTEX_PRIVATE */
74 63
75#endif /* _SPARC64_MUTEX_H_ */ 64#endif /* _SPARC64_MUTEX_H_ */

cvs diff -r1.3 -r1.4 src/sys/arch/usermode/include/mutex.h (expand / switch to unified diff)

--- src/sys/arch/usermode/include/mutex.h 2008/04/28 20:23:39 1.3
+++ src/sys/arch/usermode/include/mutex.h 2019/11/29 22:55:34 1.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: mutex.h,v 1.3 2008/04/28 20:23:39 martin Exp $ */ 1/* $NetBSD: mutex.h,v 1.4 2019/11/29 22:55:34 riastradh Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2002, 2006 The NetBSD Foundation, Inc. 4 * Copyright (c) 2002, 2006 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 and Andrew Doran. 8 * by Jason R. Thorpe and Andrew Doran.
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.
@@ -44,32 +44,22 @@ struct kmutex { @@ -44,32 +44,22 @@ struct kmutex {
44 } s; 44 } s;
45#endif 45#endif
46 } u; 46 } u;
47}; 47};
48 48
49#ifdef __MUTEX_PRIVATE 49#ifdef __MUTEX_PRIVATE
50 50
51#define mtx_owner u.mtxa_owner 51#define mtx_owner u.mtxa_owner
52#define mtx_ipl u.s.mtxs_ipl 52#define mtx_ipl u.s.mtxs_ipl
53#define mtx_lock u.s.mtxs_lock 53#define mtx_lock u.s.mtxs_lock
54 54
55#define __HAVE_SIMPLE_MUTEXES 1 55#define __HAVE_SIMPLE_MUTEXES 1
56 56
57/* 
58 * MUTEX_RECEIVE: no memory barrier required, as 'ret' implies a load fence. 
59 */ 
60#define MUTEX_RECEIVE(mtx) /* nothing */ 
61 
62/* 
63 * MUTEX_GIVE: no memory barrier required, as _lock_cas() will take care of it. 
64 */ 
65#define MUTEX_GIVE(mtx) /* nothing */ 
66 
67#define MUTEX_CAS(p, o, n) \ 57#define MUTEX_CAS(p, o, n) \
68 (_atomic_cas_ulong((volatile unsigned long *)(p), (o), (n)) == (o)) 58 (_atomic_cas_ulong((volatile unsigned long *)(p), (o), (n)) == (o))
69 59
70unsigned long _atomic_cas_ulong(volatile unsigned long *, 60unsigned long _atomic_cas_ulong(volatile unsigned long *,
71 unsigned long, unsigned long); 61 unsigned long, unsigned long);
72 62
73#endif /* __MUTEX_PRIVATE */ 63#endif /* __MUTEX_PRIVATE */
74 64
75#endif /* _ARCH_USERMODE_INCLUDE_MUTEX_H_ */ 65#endif /* _ARCH_USERMODE_INCLUDE_MUTEX_H_ */

cvs diff -r1.14 -r1.15 src/sys/arch/vax/include/mutex.h (expand / switch to unified diff)

--- src/sys/arch/vax/include/mutex.h 2014/08/14 11:28:13 1.14
+++ src/sys/arch/vax/include/mutex.h 2019/11/29 22:55:34 1.15
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: mutex.h,v 1.14 2014/08/14 11:28:13 martin Exp $ */ 1/* $NetBSD: mutex.h,v 1.15 2019/11/29 22:55:34 riastradh Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2002, 2007 The NetBSD Foundation, Inc. 4 * Copyright (c) 2002, 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 and Andrew Doran. 8 * by Jason R. Thorpe and Andrew Doran.
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.
@@ -61,29 +61,18 @@ struct kmutex { @@ -61,29 +61,18 @@ struct kmutex {
61 volatile uint8_t mtxs_unused; 61 volatile uint8_t mtxs_unused;
62 } s; 62 } s;
63 } u; 63 } u;
64}; 64};
65 65
66#define mtx_owner u.mtxa_owner 66#define mtx_owner u.mtxa_owner
67#define mtx_ipl u.s.mtxs_ipl 67#define mtx_ipl u.s.mtxs_ipl
68#define mtx_lock u.s.mtxs_lock 68#define mtx_lock u.s.mtxs_lock
69 69
70#define __HAVE_MUTEX_STUBS 1 70#define __HAVE_MUTEX_STUBS 1
71#define __HAVE_SPIN_MUTEX_STUBS 1 71#define __HAVE_SPIN_MUTEX_STUBS 1
72#define __HAVE_SIMPLE_MUTEXES 1 72#define __HAVE_SIMPLE_MUTEXES 1
73 73
74/* 
75 * MUTEX_RECEIVE: no memory barrier required; we're synchronizing against 
76 * interrupts, not multiple processors. 
77 */ 
78#define MUTEX_RECEIVE(mtx) /* nothing */ 
79 
80/* 
81 * MUTEX_GIVE: no memory barrier required; same reason. 
82 */ 
83#define MUTEX_GIVE(mtx) /* nothing */ 
84 
85#define MUTEX_CAS(p, o, n) (atomic_cas_ulong((p), (o), (n)) == (o)) 74#define MUTEX_CAS(p, o, n) (atomic_cas_ulong((p), (o), (n)) == (o))
86 75
87#endif /* __MUTEX_PRIVATE */ 76#endif /* __MUTEX_PRIVATE */
88 77
89#endif /* _VAX_MUTEX_H_ */ 78#endif /* _VAX_MUTEX_H_ */

cvs diff -r1.6 -r1.7 src/sys/arch/x86/include/mutex.h (expand / switch to unified diff)

--- src/sys/arch/x86/include/mutex.h 2009/04/24 17:49:51 1.6
+++ src/sys/arch/x86/include/mutex.h 2019/11/29 22:55:34 1.7
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: mutex.h,v 1.6 2009/04/24 17:49:51 ad Exp $ */ 1/* $NetBSD: mutex.h,v 1.7 2019/11/29 22:55:34 riastradh Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2002, 2006, 2009 The NetBSD Foundation, Inc. 4 * Copyright (c) 2002, 2006, 2009 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 and Andrew Doran. 8 * by Jason R. Thorpe and Andrew Doran.
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.
@@ -46,35 +46,22 @@ struct kmutex { @@ -46,35 +46,22 @@ struct kmutex {
46 } u; 46 } u;
47}; 47};
48 48
49#ifdef __MUTEX_PRIVATE 49#ifdef __MUTEX_PRIVATE
50 50
51#define mtx_owner u.mtxa_owner 51#define mtx_owner u.mtxa_owner
52#define mtx_ipl u.s.mtxs_ipl 52#define mtx_ipl u.s.mtxs_ipl
53#define mtx_lock u.s.mtxs_lock 53#define mtx_lock u.s.mtxs_lock
54 54
55#define __HAVE_MUTEX_STUBS 1 55#define __HAVE_MUTEX_STUBS 1
56#define __HAVE_SPIN_MUTEX_STUBS 1 56#define __HAVE_SPIN_MUTEX_STUBS 1
57#define __HAVE_SIMPLE_MUTEXES 1 57#define __HAVE_SIMPLE_MUTEXES 1
58 58
59/* 
60 * MUTEX_RECEIVE: technically, no memory barrier is required 
61 * as 'ret' implies a load fence. However we need this to 
62 * handle a bug with some Opteron revisions. See patch.c, 
63 * lock_stubs.S. 
64 */ 
65#define MUTEX_RECEIVE(mtx) membar_consumer() 
66 
67/* 
68 * MUTEX_GIVE: no memory barrier required, as _lock_cas() will take care of it. 
69 */ 
70#define MUTEX_GIVE(mtx) /* nothing */ 
71 
72#define MUTEX_CAS(p, o, n) \ 59#define MUTEX_CAS(p, o, n) \
73 (_atomic_cas_ulong((volatile unsigned long *)(p), (o), (n)) == (o)) 60 (_atomic_cas_ulong((volatile unsigned long *)(p), (o), (n)) == (o))
74 61
75unsigned long _atomic_cas_ulong(volatile unsigned long *, 62unsigned long _atomic_cas_ulong(volatile unsigned long *,
76 unsigned long, unsigned long); 63 unsigned long, unsigned long);
77 64
78#endif /* __MUTEX_PRIVATE */ 65#endif /* __MUTEX_PRIVATE */
79 66
80#endif /* _X86_MUTEX_H_ */ 67#endif /* _X86_MUTEX_H_ */