Subversion Repositories Kolibri OS

Rev

Rev 2288 | Rev 2455 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2288 Rev 2381
Line 3... Line 3...
3
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
4
;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa      ;;
4
;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa      ;;
5
;; Distributed under terms of the GNU General Public License    ;;
5
;; Distributed under terms of the GNU General Public License    ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 7... Line 7...
7
 
7
 
Line 8... Line 8...
8
$Revision: 2288 $
8
$Revision: 2381 $
9
 
9
 
10
 
10
 
Line 221... Line 221...
221
        ret
221
        ret
222
;end.
222
;end.
Line 223... Line 223...
223
 
223
 
224
 
-
 
225
 
224
 
226
struc MUTEX_WAITER
225
 
227
{
-
 
228
    .list   LHEAD
226
struct  MUTEX_WAITER
229
    .task   rd 1
-
 
230
    .sizeof:
-
 
231
};
-
 
232
 
-
 
Line 233... Line 227...
233
virtual at 0
227
        list    LHEAD
Line 234... Line 228...
234
 MUTEX_WAITER MUTEX_WAITER
228
        task    dd ?
235
end virtual
229
ends
236
 
230
 
237
;void  __fastcall mutex_init(struct mutex *lock)
231
;void  __fastcall mutex_init(struct mutex *lock)
238
 
232
 
239
align 4
233
align 4
Line 240... Line 234...
240
mutex_init:
234
mutex_init:
Line 253... Line 247...
253
        jns     .done
247
        jns     .done
Line 254... Line 248...
254
 
248
 
255
        pushfd
249
        pushfd
Line 256... Line 250...
256
        cli
250
        cli
Line 257... Line 251...
257
 
251
 
Line 258... Line 252...
258
        sub     esp, MUTEX_WAITER.sizeof
252
        sub     esp, sizeof.MUTEX_WAITER
259
 
253
 
Line 276... Line 270...
276
        mov     edx, [esp+MUTEX_WAITER.list.next]
270
        mov     edx, [esp+MUTEX_WAITER.list.next]
277
        mov     eax, [esp+MUTEX_WAITER.list.prev]
271
        mov     eax, [esp+MUTEX_WAITER.list.prev]
Line 278... Line 272...
278
 
272
 
279
        mov     [eax+MUTEX_WAITER.list.next], edx
273
        mov     [eax+MUTEX_WAITER.list.next], edx
280
        mov     [edx+MUTEX_WAITER.list.prev], eax
274
        mov     [edx+MUTEX_WAITER.list.prev], eax
281
        cmp     [ecx+MUTEX.wait.next], ecx
275
        cmp     [ecx+MUTEX.lhead.next], ecx
Line 282... Line 276...
282
        jne     @F
276
        jne     @F
283
 
277
 
284
        mov     [ecx+MUTEX.count], 0
278
        mov     [ecx+MUTEX.count], 0
Line 285... Line 279...
285
@@:
279
@@:
286
        add     esp, MUTEX_WAITER.sizeof
280
        add     esp, sizeof.MUTEX_WAITER
287
 
281
 
Line 295... Line 289...
295
mutex_unlock:
289
mutex_unlock:
Line 296... Line 290...
296
 
290
 
297
        pushfd
291
        pushfd
Line 298... Line 292...
298
        cli
292
        cli
299
 
293
 
300
        mov     eax, [ecx+MUTEX.wait.next]
294
        mov     eax, [ecx+MUTEX.lhead.next]
301
        cmp     eax, ecx
295
        cmp     eax, ecx
Line 302... Line 296...
302
        mov     [ecx+MUTEX.count], 1
296
        mov     [ecx+MUTEX.count], 1