1 /* Copyright (C) 2003 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, write to the Free
16 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20 #include <shlib-compat.h>
21 #include <lowlevelcond.h>
22 #include "lowlevel-atomic.h"
32 .type __condvar_cleanup, @function
33 .globl __condvar_cleanup
34 .hidden __condvar_cleanup
40 /* Get internal lock. */
43 XADD (r3, @(cond_lock,r8), r2)
63 mov.l @(wakeup_seq,r8),r0
64 mov.l @(wakeup_seq+4,r8),r1
67 mov.l r0,@(wakeup_seq,r8)
68 mov.l r1,@(wakeup_seq+4,r8)
71 mov.l @(woken_seq,r8),r0
72 mov.l @(woken_seq+4,r8),r1
75 mov.l r0,@(woken_seq,r8)
76 mov.l r1,@(woken_seq+4,r8)
78 /* Release internal lock. */
80 DEC (@(cond_lock,r8), r2)
102 .long __lll_mutex_lock_wait-.Lwait0b
104 .long __lll_mutex_unlock_wake-.Lwake0b
105 .size __condvar_cleanup, .-__condvar_cleanup
108 /* int pthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex) */
109 .globl __pthread_cond_wait
110 .type __pthread_cond_wait, @function
121 /* Get internal lock. */
124 XADD (r3, @(cond_lock,r8), r2)
131 /* Unlock the mutex. */
141 mov.l @(total_seq,r8),r0
142 mov.l @(total_seq+4,r8),r1
145 mov.l r0,@(total_seq,r8)
146 mov.l r1,@(total_seq+4,r8)
148 /* Install cancellation handler. */
153 mov.l .Lccleanup0, r5
156 mov.l .Lccleanup0, r5
166 /* Get and store current wakeup_seq value. */
167 mov.l @(wakeup_seq,r8), r0
168 mov.l @(wakeup_seq+4,r8), r1
175 DEC (@(cond_lock,r8), r2)
206 XADD (r3, @(cond_lock,r8), r2)
213 mov.l @(woken_seq,r8), r0
214 mov.l @(woken_seq+4,r8), r1
216 mov.l @(wakeup_seq,r8), r2
217 mov.l @(wakeup_seq+4,r8), r3
240 mov.l @(woken_seq,r8),r0
241 mov.l @(woken_seq+4,r8),r1
244 mov.l r0,@(woken_seq,r8)
245 mov.l r1,@(woken_seq+4,r8)
248 DEC (@(cond_lock,r8), r2)
256 /* Remove cancellation handler. */
272 /* We return the result of the mutex_lock operation. */
281 .long __pthread_mutex_unlock_internal-.Lmunlock0b
284 .long _GLOBAL_OFFSET_TABLE_
286 .long __condvar_cleanup@GOTOFF
289 .long __condvar_cleanup
292 .long __pthread_cleanup_push-.Lccpush0b
294 .long __pthread_enable_asynccancel-.Lenable0b
296 .long __pthread_disable_asynccancel-.Ldisable0b
298 .long __pthread_cleanup_pop-.Lcpop0b
300 .long __pthread_mutex_lock_internal-.Lmlocki0b
303 /* Initial locking failed. */
315 /* Unlock in loop requires waekup. */
328 /* Locking in loop failed. */
341 /* Unlock after loop requires wakeup. */
355 .long __lll_mutex_lock_wait-.Lmwait0b
357 .long __lll_mutex_unlock_wake-.Lmwake0b
359 .long __lll_mutex_lock_wait-.Lmwait1b
361 .long __lll_mutex_unlock_wake-.Lmwake1b
362 .size __pthread_cond_wait, .-__pthread_cond_wait
363 versioned_symbol (libpthread, __pthread_cond_wait, pthread_cond_wait,