| 1 |
// -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
| 2 |
// |
| 3 |
// This Source Code Form is subject to the terms of the Mozilla Public |
| 4 |
// License, v. 2.0. If a copy of the MPL was not distributed with this |
| 5 |
// file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 6 |
|
| 7 |
// PRInt32 _PR_x86_64_AtomicIncrement(PRInt32 *val) |
| 8 |
// |
| 9 |
// Atomically increment the integer pointed to by 'val' and return |
| 10 |
// the result of the increment. |
| 11 |
// |
| 12 |
.text |
| 13 |
.globl _PR_x86_64_AtomicIncrement |
| 14 |
.type _PR_x86_64_AtomicIncrement, @function |
| 15 |
.align 4 |
| 16 |
_PR_x86_64_AtomicIncrement: |
| 17 |
movl $1, %eax |
| 18 |
lock |
| 19 |
xaddl %eax, (%rdi) |
| 20 |
incl %eax |
| 21 |
ret |
| 22 |
.size _PR_x86_64_AtomicIncrement, .-_PR_x86_64_AtomicIncrement |
| 23 |
|
| 24 |
// PRInt32 _PR_x86_64_AtomicDecrement(PRInt32 *val) |
| 25 |
// |
| 26 |
// Atomically decrement the integer pointed to by 'val' and return |
| 27 |
// the result of the decrement. |
| 28 |
// |
| 29 |
.text |
| 30 |
.globl _PR_x86_64_AtomicDecrement |
| 31 |
.type _PR_x86_64_AtomicDecrement, @function |
| 32 |
.align 4 |
| 33 |
_PR_x86_64_AtomicDecrement: |
| 34 |
movl $-1, %eax |
| 35 |
lock |
| 36 |
xaddl %eax, (%rdi) |
| 37 |
decl %eax |
| 38 |
ret |
| 39 |
.size _PR_x86_64_AtomicDecrement, .-_PR_x86_64_AtomicDecrement |
| 40 |
|
| 41 |
// PRInt32 _PR_x86_64_AtomicSet(PRInt32 *val, PRInt32 newval) |
| 42 |
// |
| 43 |
// Atomically set the integer pointed to by 'val' to the new |
| 44 |
// value 'newval' and return the old value. |
| 45 |
// |
| 46 |
.text |
| 47 |
.globl _PR_x86_64_AtomicSet |
| 48 |
.type _PR_x86_64_AtomicSet, @function |
| 49 |
.align 4 |
| 50 |
_PR_x86_64_AtomicSet: |
| 51 |
movl %esi, %eax |
| 52 |
xchgl %eax, (%rdi) |
| 53 |
ret |
| 54 |
.size _PR_x86_64_AtomicSet, .-_PR_x86_64_AtomicSet |
| 55 |
|
| 56 |
// PRInt32 _PR_x86_64_AtomicAdd(PRInt32 *ptr, PRInt32 val) |
| 57 |
// |
| 58 |
// Atomically add 'val' to the integer pointed to by 'ptr' |
| 59 |
// and return the result of the addition. |
| 60 |
// |
| 61 |
.text |
| 62 |
.globl _PR_x86_64_AtomicAdd |
| 63 |
.type _PR_x86_64_AtomicAdd, @function |
| 64 |
.align 4 |
| 65 |
_PR_x86_64_AtomicAdd: |
| 66 |
movl %esi, %eax |
| 67 |
lock |
| 68 |
xaddl %eax, (%rdi) |
| 69 |
addl %esi, %eax |
| 70 |
ret |
| 71 |
.size _PR_x86_64_AtomicAdd, .-_PR_x86_64_AtomicAdd |
| 72 |
|
| 73 |
// Magic indicating no need for an executable stack |
| 74 |
.section .note.GNU-stack, "", @progbits |