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