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 _PR_x86_64_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 _PR_x86_64_AtomicIncrement michael@0: .type _PR_x86_64_AtomicIncrement, @function michael@0: .align 4 michael@0: _PR_x86_64_AtomicIncrement: michael@0: movl $1, %eax michael@0: lock michael@0: xaddl %eax, (%rdi) michael@0: incl %eax michael@0: ret michael@0: .size _PR_x86_64_AtomicIncrement, .-_PR_x86_64_AtomicIncrement michael@0: michael@0: // PRInt32 _PR_x86_64_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 _PR_x86_64_AtomicDecrement michael@0: .type _PR_x86_64_AtomicDecrement, @function michael@0: .align 4 michael@0: _PR_x86_64_AtomicDecrement: michael@0: movl $-1, %eax michael@0: lock michael@0: xaddl %eax, (%rdi) michael@0: decl %eax michael@0: ret michael@0: .size _PR_x86_64_AtomicDecrement, .-_PR_x86_64_AtomicDecrement michael@0: michael@0: // PRInt32 _PR_x86_64_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 _PR_x86_64_AtomicSet michael@0: .type _PR_x86_64_AtomicSet, @function michael@0: .align 4 michael@0: _PR_x86_64_AtomicSet: michael@0: movl %esi, %eax michael@0: xchgl %eax, (%rdi) michael@0: ret michael@0: .size _PR_x86_64_AtomicSet, .-_PR_x86_64_AtomicSet michael@0: michael@0: // PRInt32 _PR_x86_64_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 _PR_x86_64_AtomicAdd michael@0: .type _PR_x86_64_AtomicAdd, @function michael@0: .align 4 michael@0: _PR_x86_64_AtomicAdd: michael@0: movl %esi, %eax michael@0: lock michael@0: xaddl %eax, (%rdi) michael@0: addl %esi, %eax michael@0: ret michael@0: .size _PR_x86_64_AtomicAdd, .-_PR_x86_64_AtomicAdd michael@0: michael@0: // Magic indicating no need for an executable stack michael@0: .section .note.GNU-stack, "", @progbits ; .previous