Version 4.2.0.1, tag libreoffice-4.2.0.1
[LibreOffice.git] / sal / osl / unx / asm / interlck_x86.s
blob69322d870f0b239ab2c9592cb1f65d6f4b912038
1 /#
2 # This file is part of the LibreOffice project.
4 # This Source Code Form is subject to the terms of the Mozilla Public
5 # License, v. 2.0. If a copy of the MPL was not distributed with this
6 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 # This file incorporates work covered by the following license notice:
10 # Licensed to the Apache Software Foundation (ASF) under one or more
11 # contributor license agreements. See the NOTICE file distributed
12 # with this work for additional information regarding copyright
13 # ownership. The ASF licenses this file to you under the Apache
14 # License, Version 2.0 (the "License"); you may not use this file
15 # except in compliance with the License. You may obtain a copy of
16 # the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 .section .text,"ax"
20 .globl osl_incrementInterlockedCount
22 osl_incrementInterlockedCount:
24 push %ebp
25 mov %esp,%ebp
26 push %ebx
27 call 1f
29 pop %ebx
30 add $_GLOBAL_OFFSET_TABLE_+0x1,%ebx
31 mov 8(%ebp),%ecx
32 mov $1,%eax
33 mov osl_isSingleCPU@GOT(%ebx),%edx
34 cmp $0,(%edx)
35 je 2f
36 xadd %eax,(%ecx)
37 jmp 3f
39 lock
40 xadd %eax,(%ecx)
42 inc %eax
43 pop %ebx
44 mov %ebp,%esp
45 pop %ebp
46 ret
48 .type osl_incrementInterlockedCount,@function
49 .size osl_incrementInterlockedCount,.-osl_incrementInterlockedCount
51 .section .text,"ax"
52 .globl osl_decrementInterlockedCount
54 osl_decrementInterlockedCount:
56 push %ebp
57 mov %esp,%ebp
58 push %ebx
59 call 1f
61 pop %ebx
62 add $_GLOBAL_OFFSET_TABLE_+0x1,%ebx
63 mov 8(%ebp),%ecx
64 orl $-1,%eax
65 mov osl_isSingleCPU@GOT(%ebx),%edx
66 cmp $0,(%edx)
67 je 2f
68 xadd %eax,(%ecx)
69 jmp 3f
70 2:
71 lock
72 xadd %eax,(%ecx)
74 dec %eax
75 pop %ebx
76 mov %ebp,%esp
77 pop %ebp
78 ret
80 .type osl_decrementInterlockedCount,@function
81 .size osl_decrementInterlockedCount,.-osl_decrementInterlockedCount