xref: /trunk/main/sal/osl/unx/asm/interlck_x86.s (revision b5da552c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 
25 .section   .text,"ax"
26  .globl   osl_incrementInterlockedCount
27 
28 osl_incrementInterlockedCount:
29 
30     push       %ebp
31     mov        %esp,%ebp
32     push       %ebx
33     call       1f
34 1:
35     pop        %ebx
36     add        $_GLOBAL_OFFSET_TABLE_+0x1,%ebx
37     mov        8(%ebp),%ecx
38     mov        $1,%eax
39     mov        osl_isSingleCPU@GOT(%ebx),%edx
40     cmp        $0,(%edx)
41     je         2f
42     xadd       %eax,(%ecx)
43     jmp        3f
44 2:
45     lock
46     xadd       %eax,(%ecx)
47 3:
48     inc        %eax
49     pop        %ebx
50     mov        %ebp,%esp
51     pop        %ebp
52     ret
53 
54  .type  osl_incrementInterlockedCount,@function
55  .size  osl_incrementInterlockedCount,.-osl_incrementInterlockedCount
56 
57 .section   .text,"ax"
58  .globl   osl_decrementInterlockedCount
59 
60 osl_decrementInterlockedCount:
61 
62     push       %ebp
63     mov        %esp,%ebp
64     push       %ebx
65     call       1f
66 1:
67     pop        %ebx
68     add        $_GLOBAL_OFFSET_TABLE_+0x1,%ebx
69     mov        8(%ebp),%ecx
70     orl        $-1,%eax
71     mov        osl_isSingleCPU@GOT(%ebx),%edx
72     cmp        $0,(%edx)
73     je         2f
74     xadd       %eax,(%ecx)
75     jmp        3f
76 2:
77     lock
78     xadd       %eax,(%ecx)
79 3:
80     dec        %eax
81     pop        %ebx
82     mov        %ebp,%esp
83     pop        %ebp
84     ret
85 
86  .type  osl_decrementInterlockedCount,@function
87  .size  osl_decrementInterlockedCount,.-osl_decrementInterlockedCount
88 
89