Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright (C) 2001-2003 FhG Fokus |
3 | | * |
4 | | * This file is part of opensips, a free SIP server. |
5 | | * |
6 | | * opensips is free software; you can redistribute it and/or modify |
7 | | * it under the terms of the GNU General Public License as published by |
8 | | * the Free Software Foundation; either version 2 of the License, or |
9 | | * (at your option) any later version |
10 | | * |
11 | | * opensips is distributed in the hope that it will be useful, |
12 | | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | | * GNU General Public License for more details. |
15 | | * |
16 | | * You should have received a copy of the GNU General Public License |
17 | | * along with this program; if not, write to the Free Software |
18 | | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
19 | | * |
20 | | * History: |
21 | | * -------- |
22 | | * 2002-02-05 created by andrei |
23 | | * 2003-01-16 added PPC locking code contributed by Dinos Dorkofikis |
24 | | * <kdor@intranet.gr> |
25 | | * 2004-09-12 added MIPS locking for ISA>=2 (>r3000) (andrei) |
26 | | * 2004-12-16 for now use the same locking code for sparc32 as for sparc64 |
27 | | * (it will work only if NOSMP is defined) (andrei) |
28 | | * |
29 | | * 2005-04-27 added alpha locking code (andrei) |
30 | | * 2005-05-25 PPC locking code enabled for PPC64; added a lwsync to |
31 | | * the tsl part and replaced the sync with a lwsync for the |
32 | | * unlock part (andrei) |
33 | | * 2016-12-07 Add support for armv6 (razvanc) |
34 | | * 2016-12-07 Add support for armv7 - not tested (razvanc) |
35 | | */ |
36 | | |
37 | | /*! |
38 | | * \file |
39 | | * \brief Assembler routines for fast architecture dependend locking. |
40 | | * |
41 | | * Contains the assembler routines for the fast architecture dependend |
42 | | * locking primitives used by the server. This routines are needed e.g. |
43 | | * to protect shared data structures that are accessed from muliple processes. |
44 | | * \todo replace this with the assembler routines provided by the linux kernel |
45 | | */ |
46 | | |
47 | | |
48 | | #ifndef fastlock_h |
49 | | #define fastlock_h |
50 | | |
51 | | #include <sched.h> |
52 | | |
53 | | |
54 | | #define SPIN_OPTIMIZE /* if defined optimize spining on the lock: |
55 | | try first the lock with non-atomic/non memory locking |
56 | | operations, and only if the lock appears to be free |
57 | | switch to the more expensive version */ |
58 | | |
59 | | /*! The actual lock */ |
60 | | #ifndef DBG_LOCK |
61 | | typedef volatile int fl_lock_t; |
62 | | #else |
63 | | typedef struct fl_lock_t_{ |
64 | | volatile int lock; |
65 | | char* file; |
66 | | char* func; |
67 | | unsigned long line; |
68 | | } fl_lock_t; |
69 | | #endif |
70 | | |
71 | | /*! Initialize a lock, zero is unlocked. */ |
72 | | #ifndef DBG_LOCK |
73 | 0 | #define init_lock( l ) (l)=0 |
74 | | #else |
75 | | #define init_lock( l ) (l).lock = 0 |
76 | | #endif |
77 | | |
78 | | |
79 | | |
80 | | /*! \brief |
81 | | * Test and set a lock. Used by the get_lock function. |
82 | | * \param lock the lock that should be set |
83 | | * \return 1 if the lock is held by someone else, 0 otherwise |
84 | | * \see get_lock |
85 | | */ |
86 | | #ifndef DBG_LOCK |
87 | | inline static int tsl(fl_lock_t* lock) |
88 | | #else |
89 | | inline static int tsl(volatile int* lock) |
90 | | #endif |
91 | 0 | { |
92 | 0 | int val; |
93 | |
|
94 | 0 | #if defined(__CPU_i386) || defined(__CPU_x86_64) |
95 | |
|
96 | | #ifdef NOSMP |
97 | | asm volatile( |
98 | | " xor %0, %0 \n\t" |
99 | | " btsl $0, %2 \n\t" |
100 | | " setc %b0 \n\t" |
101 | | : "=&q" (val), "=m" (*lock) : "m"(*lock) : "memory", "cc" |
102 | | ); |
103 | | #else |
104 | 0 | asm volatile( |
105 | 0 | #ifdef SPIN_OPTIMIZE |
106 | 0 | " cmpb $0, %2 \n\t" |
107 | 0 | " mov $1, %0 \n\t" |
108 | 0 | " jnz 1f \n\t" |
109 | | #else |
110 | | " mov $1, %0 \n\t" |
111 | | #endif |
112 | 0 | " xchgb %2, %b0 \n\t" |
113 | 0 | "1: \n\t" |
114 | 0 | : "=&q" (val), "=m" (*lock) : "m"(*lock) : "memory" |
115 | 0 | #ifdef SPIN_OPTIMIZE |
116 | 0 | , "cc" |
117 | 0 | #endif |
118 | 0 | ); |
119 | 0 | #endif /*NOSMP*/ |
120 | | #elif defined(__CPU_sparc64) || defined(__CPU_sparc) |
121 | | asm volatile( |
122 | | "ldstub [%1], %0 \n\t" |
123 | | #ifndef NOSMP |
124 | | "membar #StoreStore | #StoreLoad \n\t" |
125 | | #endif |
126 | | : "=&r"(val) : "r"(lock):"memory" |
127 | | ); |
128 | | |
129 | | #elif defined __CPU_arm |
130 | | asm volatile( |
131 | | "swp %0, %2, [%3] \n\t" |
132 | | : "=&r" (val), "=m"(*lock) : "r"(1), "r" (lock) : "memory" |
133 | | ); |
134 | | |
135 | | #elif defined(__CPU_arm6) || defined(__CPU_arm7) |
136 | | asm volatile( |
137 | | "ldrex %0, [%2] \n\t" |
138 | | "cmp %0, #0 \n\t" |
139 | | "it eq \n\t" |
140 | | "strexeq %0, %1, [%2] \n\t" |
141 | | #ifndef NOSMP |
142 | | #if defined(__CPU_arm7) |
143 | | "dmb \n\t" |
144 | | #else |
145 | | "mcr p15, #0, r1, c7, c10, #5\n\t" |
146 | | #endif |
147 | | #endif |
148 | | : "=&r" (val) : "r"(1), "r" (lock) : "cc", "memory" |
149 | | ); |
150 | | #elif defined(__CPU_ppc) || defined(__CPU_ppc64) |
151 | | asm volatile( |
152 | | "1: lwarx %0, 0, %2\n\t" |
153 | | " cmpwi %0, 0\n\t" |
154 | | " bne 0f\n\t" |
155 | | " stwcx. %1, 0, %2\n\t" |
156 | | " bne- 1b\n\t" |
157 | | " lwsync\n\t" /* lwsync or isync, lwsync is faster |
158 | | and should work, see |
159 | | [ IBM Programming environments Manual, D.4.1.1] |
160 | | */ |
161 | | "0:\n\t" |
162 | | : "=&r" (val) : "r"(1), "b" (lock) : "memory", "cc" |
163 | | ); |
164 | | #elif defined(__CPU_mips2) || defined(__CPU_mips32) || defined(__CPU_mips64) |
165 | | long tmp; |
166 | | |
167 | | asm volatile( |
168 | | ".set push \n\t" |
169 | | ".set noreorder\n\t" |
170 | | ".set mips2 \n\t" |
171 | | "1: ll %1, %2 \n\t" |
172 | | " li %0, 1 \n\t" |
173 | | " sc %0, %2 \n\t" |
174 | | " beqz %0, 1b \n\t" |
175 | | " nop \n\t" |
176 | | #ifndef NOSMP |
177 | | " sync \n\t" |
178 | | #endif |
179 | | ".set pop\n\t" |
180 | | : "=&r" (tmp), "=&r" (val), "=m" (*lock) |
181 | | : "m" (*lock) |
182 | | : "memory" |
183 | | ); |
184 | | #elif defined __CPU_alpha |
185 | | long tmp; |
186 | | tmp=0; |
187 | | /* lock low bit set to 1 when the lock is hold and to 0 otherwise */ |
188 | | asm volatile( |
189 | | "1: ldl %0, %1 \n\t" |
190 | | " blbs %0, 2f \n\t" /* optimization if locked */ |
191 | | " ldl_l %0, %1 \n\t" |
192 | | " blbs %0, 2f \n\t" |
193 | | " lda %2, 1 \n\t" /* or: or $31, 1, %2 ??? */ |
194 | | " stl_c %2, %1 \n\t" |
195 | | " beq %2, 1b \n\t" |
196 | | " mb \n\t" |
197 | | "2: \n\t" |
198 | | :"=&r" (val), "=m"(*lock), "=&r"(tmp) |
199 | | :"m"(*lock) |
200 | | : "memory" |
201 | | ); |
202 | | #else |
203 | | #error "unknown architecture" |
204 | | #endif |
205 | 0 | return val; |
206 | 0 | } Unexecuted instantiation: msg_parser.c:tsl Unexecuted instantiation: parse_uri.c:tsl Unexecuted instantiation: parse_fline.c:tsl Unexecuted instantiation: parse_hname2.c:tsl Unexecuted instantiation: parse_content.c:tsl Unexecuted instantiation: hf.c:tsl Unexecuted instantiation: parse_to.c:tsl Unexecuted instantiation: parse_via.c:tsl Unexecuted instantiation: dprint.c:tsl Unexecuted instantiation: pt.c:tsl Unexecuted instantiation: strcommon.c:tsl Unexecuted instantiation: ut.c:tsl Unexecuted instantiation: sdp_ops.c:tsl Unexecuted instantiation: statistics.c:tsl Unexecuted instantiation: pvar.c:tsl Unexecuted instantiation: route.c:tsl Unexecuted instantiation: socket_info.c:tsl Unexecuted instantiation: ipc.c:tsl Unexecuted instantiation: core_stats.c:tsl Unexecuted instantiation: route_struct.c:tsl Unexecuted instantiation: dset.c:tsl Unexecuted instantiation: pt_scaling.c:tsl Unexecuted instantiation: pt_load.c:tsl Unexecuted instantiation: sr_module.c:tsl Unexecuted instantiation: action.c:tsl Unexecuted instantiation: flags.c:tsl Unexecuted instantiation: db_insertq.c:tsl Unexecuted instantiation: db.c:tsl Unexecuted instantiation: proto_tcp.c:tsl Unexecuted instantiation: proto_udp.c:tsl Unexecuted instantiation: trans.c:tsl Unexecuted instantiation: net_tcp_proc.c:tsl Unexecuted instantiation: net_tcp.c:tsl Unexecuted instantiation: tcp_common.c:tsl Unexecuted instantiation: net_udp.c:tsl Unexecuted instantiation: tcp_conn_profile.c:tsl Unexecuted instantiation: trans_trace.c:tsl Unexecuted instantiation: net_tcp_report.c:tsl Unexecuted instantiation: shm_mem.c:tsl Unexecuted instantiation: f_parallel_malloc.c:tsl Unexecuted instantiation: common.c:tsl Unexecuted instantiation: q_malloc.c:tsl Unexecuted instantiation: rpm_mem.c:tsl Unexecuted instantiation: mem.c:tsl Unexecuted instantiation: mi.c:tsl Unexecuted instantiation: item.c:tsl Unexecuted instantiation: sdp.c:tsl Unexecuted instantiation: sdp_helpr_funcs.c:tsl Unexecuted instantiation: digest_parser.c:tsl Unexecuted instantiation: param_parser.c:tsl Unexecuted instantiation: parse_contact.c:tsl Unexecuted instantiation: parse_body.c:tsl Unexecuted instantiation: parse_security.c:tsl Unexecuted instantiation: parse_call_info.c:tsl Unexecuted instantiation: parse_event.c:tsl Unexecuted instantiation: parse_disposition.c:tsl Unexecuted instantiation: parse_authenticate.c:tsl Unexecuted instantiation: parser_f.c:tsl Unexecuted instantiation: parse_rpid.c:tsl Unexecuted instantiation: parse_ppi.c:tsl Unexecuted instantiation: parse_fcaps.c:tsl Unexecuted instantiation: parse_rr.c:tsl Unexecuted instantiation: parse_param.c:tsl Unexecuted instantiation: parse_diversion.c:tsl Unexecuted instantiation: parse_nameaddr.c:tsl Unexecuted instantiation: parse_expires.c:tsl Unexecuted instantiation: parse_refer_to.c:tsl Unexecuted instantiation: parse_from.c:tsl Unexecuted instantiation: parse_pai.c:tsl Unexecuted instantiation: event_interface.c:tsl Unexecuted instantiation: evi_params.c:tsl Unexecuted instantiation: receive.c:tsl Unexecuted instantiation: ip_addr.c:tsl Unexecuted instantiation: async.c:tsl Unexecuted instantiation: daemonize.c:tsl Unexecuted instantiation: timer.c:tsl Unexecuted instantiation: trace_api.c:tsl Unexecuted instantiation: mod_fix.c:tsl Unexecuted instantiation: reactor.c:tsl Unexecuted instantiation: forward.c:tsl Unexecuted instantiation: xlog.c:tsl Unexecuted instantiation: blacklists.c:tsl Unexecuted instantiation: usr_avp.c:tsl Unexecuted instantiation: resolve.c:tsl Unexecuted instantiation: io_wait.c:tsl Unexecuted instantiation: transformations.c:tsl Unexecuted instantiation: sr_module_deps.c:tsl Unexecuted instantiation: cfg_reload.c:tsl Unexecuted instantiation: time_rec.c:tsl Unexecuted instantiation: map.c:tsl Unexecuted instantiation: status_report.c:tsl Unexecuted instantiation: signals.c:tsl Unexecuted instantiation: db_id.c:tsl Unexecuted instantiation: csv.c:tsl Unexecuted instantiation: cJSON.c:tsl Unexecuted instantiation: evi_transport.c:tsl Unexecuted instantiation: msg_translator.c:tsl Unexecuted instantiation: md5utils.c:tsl Unexecuted instantiation: cfg.tab.c:tsl Unexecuted instantiation: modparam.c:tsl Unexecuted instantiation: crc.c:tsl Unexecuted instantiation: lex.yy.c:tsl Unexecuted instantiation: cfg_pp.c:tsl Unexecuted instantiation: proxy.c:tsl Unexecuted instantiation: shutdown.c:tsl Unexecuted instantiation: core_cmds.c:tsl Unexecuted instantiation: cachedb.c:tsl Unexecuted instantiation: cachedb_id.c:tsl |
207 | | |
208 | | |
209 | | /*! \brief |
210 | | * Set a lock. |
211 | | * \param lock the lock that should be set |
212 | | * \see tsl |
213 | | */ |
214 | | #ifndef DBG_LOCK |
215 | | inline static void get_lock(fl_lock_t* lock) |
216 | 0 | { |
217 | | #else |
218 | | inline static void get_lock(fl_lock_t* lock_struct, const char* file, const char* func, unsigned int line) |
219 | | { |
220 | | volatile int *lock = &lock_struct->lock; |
221 | | #endif |
222 | |
|
223 | 0 | #ifdef ADAPTIVE_WAIT |
224 | 0 | int i=ADAPTIVE_WAIT_LOOPS; |
225 | 0 | #endif |
226 | |
|
227 | 0 | while(tsl(lock)){ |
228 | | #ifdef BUSY_WAIT |
229 | | #elif defined ADAPTIVE_WAIT |
230 | 0 | if (i>0) i--; |
231 | 0 | else sched_yield(); |
232 | | #else |
233 | | sched_yield(); |
234 | | #endif |
235 | 0 | } |
236 | |
|
237 | | #ifdef DBG_LOCK |
238 | | lock_struct->file = (char*)file; |
239 | | lock_struct->func = (char*)func; |
240 | | lock_struct->line = line; |
241 | | #endif |
242 | |
|
243 | 0 | } Unexecuted instantiation: msg_parser.c:get_lock Unexecuted instantiation: parse_uri.c:get_lock Unexecuted instantiation: parse_fline.c:get_lock Unexecuted instantiation: parse_hname2.c:get_lock Unexecuted instantiation: parse_content.c:get_lock Unexecuted instantiation: hf.c:get_lock Unexecuted instantiation: parse_to.c:get_lock Unexecuted instantiation: parse_via.c:get_lock Unexecuted instantiation: dprint.c:get_lock Unexecuted instantiation: pt.c:get_lock Unexecuted instantiation: strcommon.c:get_lock Unexecuted instantiation: ut.c:get_lock Unexecuted instantiation: sdp_ops.c:get_lock Unexecuted instantiation: statistics.c:get_lock Unexecuted instantiation: pvar.c:get_lock Unexecuted instantiation: route.c:get_lock Unexecuted instantiation: socket_info.c:get_lock Unexecuted instantiation: ipc.c:get_lock Unexecuted instantiation: core_stats.c:get_lock Unexecuted instantiation: route_struct.c:get_lock Unexecuted instantiation: dset.c:get_lock Unexecuted instantiation: pt_scaling.c:get_lock Unexecuted instantiation: pt_load.c:get_lock Unexecuted instantiation: sr_module.c:get_lock Unexecuted instantiation: action.c:get_lock Unexecuted instantiation: flags.c:get_lock Unexecuted instantiation: db_insertq.c:get_lock Unexecuted instantiation: db.c:get_lock Unexecuted instantiation: proto_tcp.c:get_lock Unexecuted instantiation: proto_udp.c:get_lock Unexecuted instantiation: trans.c:get_lock Unexecuted instantiation: net_tcp_proc.c:get_lock Unexecuted instantiation: net_tcp.c:get_lock Unexecuted instantiation: tcp_common.c:get_lock Unexecuted instantiation: net_udp.c:get_lock Unexecuted instantiation: tcp_conn_profile.c:get_lock Unexecuted instantiation: trans_trace.c:get_lock Unexecuted instantiation: net_tcp_report.c:get_lock Unexecuted instantiation: shm_mem.c:get_lock Unexecuted instantiation: f_parallel_malloc.c:get_lock Unexecuted instantiation: common.c:get_lock Unexecuted instantiation: q_malloc.c:get_lock Unexecuted instantiation: rpm_mem.c:get_lock Unexecuted instantiation: mem.c:get_lock Unexecuted instantiation: mi.c:get_lock Unexecuted instantiation: item.c:get_lock Unexecuted instantiation: sdp.c:get_lock Unexecuted instantiation: sdp_helpr_funcs.c:get_lock Unexecuted instantiation: digest_parser.c:get_lock Unexecuted instantiation: param_parser.c:get_lock Unexecuted instantiation: parse_contact.c:get_lock Unexecuted instantiation: parse_body.c:get_lock Unexecuted instantiation: parse_security.c:get_lock Unexecuted instantiation: parse_call_info.c:get_lock Unexecuted instantiation: parse_event.c:get_lock Unexecuted instantiation: parse_disposition.c:get_lock Unexecuted instantiation: parse_authenticate.c:get_lock Unexecuted instantiation: parser_f.c:get_lock Unexecuted instantiation: parse_rpid.c:get_lock Unexecuted instantiation: parse_ppi.c:get_lock Unexecuted instantiation: parse_fcaps.c:get_lock Unexecuted instantiation: parse_rr.c:get_lock Unexecuted instantiation: parse_param.c:get_lock Unexecuted instantiation: parse_diversion.c:get_lock Unexecuted instantiation: parse_nameaddr.c:get_lock Unexecuted instantiation: parse_expires.c:get_lock Unexecuted instantiation: parse_refer_to.c:get_lock Unexecuted instantiation: parse_from.c:get_lock Unexecuted instantiation: parse_pai.c:get_lock Unexecuted instantiation: event_interface.c:get_lock Unexecuted instantiation: evi_params.c:get_lock Unexecuted instantiation: receive.c:get_lock Unexecuted instantiation: ip_addr.c:get_lock Unexecuted instantiation: async.c:get_lock Unexecuted instantiation: daemonize.c:get_lock Unexecuted instantiation: timer.c:get_lock Unexecuted instantiation: trace_api.c:get_lock Unexecuted instantiation: mod_fix.c:get_lock Unexecuted instantiation: reactor.c:get_lock Unexecuted instantiation: forward.c:get_lock Unexecuted instantiation: xlog.c:get_lock Unexecuted instantiation: blacklists.c:get_lock Unexecuted instantiation: usr_avp.c:get_lock Unexecuted instantiation: resolve.c:get_lock Unexecuted instantiation: io_wait.c:get_lock Unexecuted instantiation: transformations.c:get_lock Unexecuted instantiation: sr_module_deps.c:get_lock Unexecuted instantiation: cfg_reload.c:get_lock Unexecuted instantiation: time_rec.c:get_lock Unexecuted instantiation: map.c:get_lock Unexecuted instantiation: status_report.c:get_lock Unexecuted instantiation: signals.c:get_lock Unexecuted instantiation: db_id.c:get_lock Unexecuted instantiation: csv.c:get_lock Unexecuted instantiation: cJSON.c:get_lock Unexecuted instantiation: evi_transport.c:get_lock Unexecuted instantiation: msg_translator.c:get_lock Unexecuted instantiation: md5utils.c:get_lock Unexecuted instantiation: cfg.tab.c:get_lock Unexecuted instantiation: modparam.c:get_lock Unexecuted instantiation: crc.c:get_lock Unexecuted instantiation: lex.yy.c:get_lock Unexecuted instantiation: cfg_pp.c:get_lock Unexecuted instantiation: proxy.c:get_lock Unexecuted instantiation: shutdown.c:get_lock Unexecuted instantiation: core_cmds.c:get_lock Unexecuted instantiation: cachedb.c:get_lock Unexecuted instantiation: cachedb_id.c:get_lock |
244 | | |
245 | | |
246 | | /*! \brief |
247 | | * Release a lock |
248 | | * \param lock the lock that should be released |
249 | | */ |
250 | | #ifndef DBG_LOCK |
251 | | inline static void release_lock(fl_lock_t* lock) |
252 | 0 | { |
253 | | #else |
254 | | inline static void release_lock(fl_lock_t* lock_struct) |
255 | | { |
256 | | volatile int *lock = &lock_struct->lock; |
257 | | lock_struct->file = 0; |
258 | | lock_struct->func = 0; |
259 | | lock_struct->line = 0; |
260 | | #endif |
261 | |
|
262 | | #if defined(__CPU_i386) |
263 | | #ifdef NOSMP |
264 | | asm volatile( |
265 | | " movb $0, %0 \n\t" |
266 | | : "=m"(*lock) : : "memory" |
267 | | ); |
268 | | #else /* ! NOSMP */ |
269 | | int val; |
270 | | /* a simple mov $0, (lock) does not force StoreStore ordering on all |
271 | | x86 versions and it doesn't seem to force LoadStore either */ |
272 | | asm volatile( |
273 | | " xchgb %b0, %1 \n\t" |
274 | | : "=q" (val), "=m" (*lock) : "0" (0) : "memory" |
275 | | ); |
276 | | #endif /* NOSMP */ |
277 | | #elif defined(__CPU_x86_64) |
278 | | asm volatile( |
279 | 0 | " movb $0, %0 \n\t" /* on amd64 membar StoreStore | LoadStore is |
280 | | implicit (at least on the same mem. type) */ |
281 | 0 | : "=m"(*lock) : : "memory" |
282 | 0 | ); |
283 | | #elif defined(__CPU_sparc64) || defined(__CPU_sparc) |
284 | | asm volatile( |
285 | | #ifndef NOSMP |
286 | | "membar #LoadStore | #StoreStore \n\t" /*is this really needed?*/ |
287 | | #endif |
288 | | "stb %%g0, [%1] \n\t" |
289 | | : "=m"(*lock) : "r" (lock) : "memory" |
290 | | ); |
291 | | #elif defined(__CPU_arm) || defined(__CPU_arm6) || defined(__CPU_arm7) |
292 | | asm volatile( |
293 | | #ifndef NOSMP |
294 | | #if defined(__CPU_arm7) |
295 | | "dmb \n\t" |
296 | | #else |
297 | | "mcr p15, #0, r1, c7, c10, #5\n\t" |
298 | | #endif |
299 | | #endif |
300 | | " str %1, [%2] \n\r" |
301 | | : "=m"(*lock) : "r"(0), "r"(lock) : "memory" |
302 | | ); |
303 | | #elif defined(__CPU_ppc) || defined(__CPU_ppc64) |
304 | | asm volatile( |
305 | | /* "sync\n\t" lwsync is faster and will work |
306 | | * here too |
307 | | * [IBM Programming Environments Manual, D.4.2.2] |
308 | | */ |
309 | | "lwsync\n\t" |
310 | | "stwx %1, 0, %2\n\t" |
311 | | : "=m"(*lock) : "r"(0), "r"(lock) : "memory" |
312 | | ); |
313 | | *lock = 0; |
314 | | #elif defined(__CPU_mips2) || defined(__CPU_mips32) || defined(__CPU_mips64) |
315 | | asm volatile( |
316 | | ".set push \n\t" |
317 | | ".set noreorder \n\t" |
318 | | ".set mips2 \n\t" |
319 | | #ifndef NOSMP |
320 | | " sync \n\t" |
321 | | #endif |
322 | | " sw $0, %0 \n\t" |
323 | | ".set pop \n\t" |
324 | | : "=m" (*lock) : /* no input */ : "memory" |
325 | | ); |
326 | | #elif defined __CPU_alpha |
327 | | asm volatile( |
328 | | #ifndef NOSMP |
329 | | " mb \n\t" |
330 | | #endif |
331 | | " stl $31, %0 \n\t" |
332 | | : "=m"(*lock) :/* no input*/ : "memory" /* because of the mb */ |
333 | | ); |
334 | | #else |
335 | | #error "unknown architecture" |
336 | | #endif |
337 | |
|
338 | 0 | } Unexecuted instantiation: msg_parser.c:release_lock Unexecuted instantiation: parse_uri.c:release_lock Unexecuted instantiation: parse_fline.c:release_lock Unexecuted instantiation: parse_hname2.c:release_lock Unexecuted instantiation: parse_content.c:release_lock Unexecuted instantiation: hf.c:release_lock Unexecuted instantiation: parse_to.c:release_lock Unexecuted instantiation: parse_via.c:release_lock Unexecuted instantiation: dprint.c:release_lock Unexecuted instantiation: pt.c:release_lock Unexecuted instantiation: strcommon.c:release_lock Unexecuted instantiation: ut.c:release_lock Unexecuted instantiation: sdp_ops.c:release_lock Unexecuted instantiation: statistics.c:release_lock Unexecuted instantiation: pvar.c:release_lock Unexecuted instantiation: route.c:release_lock Unexecuted instantiation: socket_info.c:release_lock Unexecuted instantiation: ipc.c:release_lock Unexecuted instantiation: core_stats.c:release_lock Unexecuted instantiation: route_struct.c:release_lock Unexecuted instantiation: dset.c:release_lock Unexecuted instantiation: pt_scaling.c:release_lock Unexecuted instantiation: pt_load.c:release_lock Unexecuted instantiation: sr_module.c:release_lock Unexecuted instantiation: action.c:release_lock Unexecuted instantiation: flags.c:release_lock Unexecuted instantiation: db_insertq.c:release_lock Unexecuted instantiation: db.c:release_lock Unexecuted instantiation: proto_tcp.c:release_lock Unexecuted instantiation: proto_udp.c:release_lock Unexecuted instantiation: trans.c:release_lock Unexecuted instantiation: net_tcp_proc.c:release_lock Unexecuted instantiation: net_tcp.c:release_lock Unexecuted instantiation: tcp_common.c:release_lock Unexecuted instantiation: net_udp.c:release_lock Unexecuted instantiation: tcp_conn_profile.c:release_lock Unexecuted instantiation: trans_trace.c:release_lock Unexecuted instantiation: net_tcp_report.c:release_lock Unexecuted instantiation: shm_mem.c:release_lock Unexecuted instantiation: f_parallel_malloc.c:release_lock Unexecuted instantiation: common.c:release_lock Unexecuted instantiation: q_malloc.c:release_lock Unexecuted instantiation: rpm_mem.c:release_lock Unexecuted instantiation: mem.c:release_lock Unexecuted instantiation: mi.c:release_lock Unexecuted instantiation: item.c:release_lock Unexecuted instantiation: sdp.c:release_lock Unexecuted instantiation: sdp_helpr_funcs.c:release_lock Unexecuted instantiation: digest_parser.c:release_lock Unexecuted instantiation: param_parser.c:release_lock Unexecuted instantiation: parse_contact.c:release_lock Unexecuted instantiation: parse_body.c:release_lock Unexecuted instantiation: parse_security.c:release_lock Unexecuted instantiation: parse_call_info.c:release_lock Unexecuted instantiation: parse_event.c:release_lock Unexecuted instantiation: parse_disposition.c:release_lock Unexecuted instantiation: parse_authenticate.c:release_lock Unexecuted instantiation: parser_f.c:release_lock Unexecuted instantiation: parse_rpid.c:release_lock Unexecuted instantiation: parse_ppi.c:release_lock Unexecuted instantiation: parse_fcaps.c:release_lock Unexecuted instantiation: parse_rr.c:release_lock Unexecuted instantiation: parse_param.c:release_lock Unexecuted instantiation: parse_diversion.c:release_lock Unexecuted instantiation: parse_nameaddr.c:release_lock Unexecuted instantiation: parse_expires.c:release_lock Unexecuted instantiation: parse_refer_to.c:release_lock Unexecuted instantiation: parse_from.c:release_lock Unexecuted instantiation: parse_pai.c:release_lock Unexecuted instantiation: event_interface.c:release_lock Unexecuted instantiation: evi_params.c:release_lock Unexecuted instantiation: receive.c:release_lock Unexecuted instantiation: ip_addr.c:release_lock Unexecuted instantiation: async.c:release_lock Unexecuted instantiation: daemonize.c:release_lock Unexecuted instantiation: timer.c:release_lock Unexecuted instantiation: trace_api.c:release_lock Unexecuted instantiation: mod_fix.c:release_lock Unexecuted instantiation: reactor.c:release_lock Unexecuted instantiation: forward.c:release_lock Unexecuted instantiation: xlog.c:release_lock Unexecuted instantiation: blacklists.c:release_lock Unexecuted instantiation: usr_avp.c:release_lock Unexecuted instantiation: resolve.c:release_lock Unexecuted instantiation: io_wait.c:release_lock Unexecuted instantiation: transformations.c:release_lock Unexecuted instantiation: sr_module_deps.c:release_lock Unexecuted instantiation: cfg_reload.c:release_lock Unexecuted instantiation: time_rec.c:release_lock Unexecuted instantiation: map.c:release_lock Unexecuted instantiation: status_report.c:release_lock Unexecuted instantiation: signals.c:release_lock Unexecuted instantiation: db_id.c:release_lock Unexecuted instantiation: csv.c:release_lock Unexecuted instantiation: cJSON.c:release_lock Unexecuted instantiation: evi_transport.c:release_lock Unexecuted instantiation: msg_translator.c:release_lock Unexecuted instantiation: md5utils.c:release_lock Unexecuted instantiation: cfg.tab.c:release_lock Unexecuted instantiation: modparam.c:release_lock Unexecuted instantiation: crc.c:release_lock Unexecuted instantiation: lex.yy.c:release_lock Unexecuted instantiation: cfg_pp.c:release_lock Unexecuted instantiation: proxy.c:release_lock Unexecuted instantiation: shutdown.c:release_lock Unexecuted instantiation: core_cmds.c:release_lock Unexecuted instantiation: cachedb.c:release_lock Unexecuted instantiation: cachedb_id.c:release_lock |
339 | | |
340 | | |
341 | | #endif |