michael@0: // -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: // michael@0: // This Source Code Form is subject to the terms of the Mozilla Public michael@0: // License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: // file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: // PRInt32 _MD_AtomicIncrement(PRInt32 *val) michael@0: // michael@0: // Atomically increment the integer pointed to by 'val' and return michael@0: // the result of the increment. michael@0: // michael@0: .text michael@0: .globl _MD_AtomicIncrement michael@0: .align 4 michael@0: _MD_AtomicIncrement: michael@0: movl $1, %eax michael@0: lock michael@0: xaddl %eax, (%rdi) michael@0: incl %eax michael@0: ret michael@0: michael@0: // PRInt32 _MD_AtomicDecrement(PRInt32 *val) michael@0: // michael@0: // Atomically decrement the integer pointed to by 'val' and return michael@0: // the result of the decrement. michael@0: // michael@0: .text michael@0: .globl _MD_AtomicDecrement michael@0: .align 4 michael@0: _MD_AtomicDecrement: michael@0: movl $-1, %eax michael@0: lock michael@0: xaddl %eax, (%rdi) michael@0: decl %eax michael@0: ret michael@0: michael@0: // PRInt32 _MD_AtomicSet(PRInt32 *val, PRInt32 newval) michael@0: // michael@0: // Atomically set the integer pointed to by 'val' to the new michael@0: // value 'newval' and return the old value. michael@0: // michael@0: .text michael@0: .globl _MD_AtomicSet michael@0: .align 4 michael@0: _MD_AtomicSet: michael@0: movl %esi, %eax michael@0: xchgl %eax, (%rdi) michael@0: ret michael@0: michael@0: // PRInt32 _MD_AtomicAdd(PRInt32 *ptr, PRInt32 val) michael@0: // michael@0: // Atomically add 'val' to the integer pointed to by 'ptr' michael@0: // and return the result of the addition. michael@0: // michael@0: .text michael@0: .globl _MD_AtomicAdd michael@0: .align 4 michael@0: _MD_AtomicAdd: michael@0: movl %esi, %eax michael@0: lock michael@0: xaddl %eax, (%rdi) michael@0: addl %esi, %eax michael@0: ret