update dev300-m57
[ooovba.git] / sal / osl / unx / asm / interlck_x86.s
blob3f9607f530f8649b6888654afd7203f7dd5ca21e
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: interlck_x86.s,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
32 .section .text,"ax"
33 .globl osl_incrementInterlockedCount
35 osl_incrementInterlockedCount:
37 push %ebp
38 mov %esp,%ebp
39 push %ebx
40 call 1f
42 pop %ebx
43 add $_GLOBAL_OFFSET_TABLE_+0x1,%ebx
44 mov 8(%ebp),%ecx
45 mov $1,%eax
46 mov osl_isSingleCPU@GOT(%ebx),%edx
47 cmp $0,(%edx)
48 je 2f
49 xadd %eax,(%ecx)
50 jmp 3f
52 lock
53 xadd %eax,(%ecx)
55 inc %eax
56 pop %ebx
57 mov %ebp,%esp
58 pop %ebp
59 ret
61 .type osl_incrementInterlockedCount,@function
62 .size osl_incrementInterlockedCount,.-osl_incrementInterlockedCount
64 .section .text,"ax"
65 .globl osl_decrementInterlockedCount
67 osl_decrementInterlockedCount:
69 push %ebp
70 mov %esp,%ebp
71 push %ebx
72 call 1f
74 pop %ebx
75 add $_GLOBAL_OFFSET_TABLE_+0x1,%ebx
76 mov 8(%ebp),%ecx
77 orl $-1,%eax
78 mov osl_isSingleCPU@GOT(%ebx),%edx
79 cmp $0,(%edx)
80 je 2f
81 xadd %eax,(%ecx)
82 jmp 3f
83 2:
84 lock
85 xadd %eax,(%ecx)
87 dec %eax
88 pop %ebx
89 mov %ebp,%esp
90 pop %ebp
91 ret
93 .type osl_decrementInterlockedCount,@function
94 .size osl_decrementInterlockedCount,.-osl_decrementInterlockedCount