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