| 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_Darwin_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_Darwin_x86_64_AtomicIncrement |
| 14 |
.private_extern __PR_Darwin_x86_64_AtomicIncrement |
| 15 |
.align 4 |
| 16 |
__PR_Darwin_x86_64_AtomicIncrement: |
| 17 |
movl $1, %eax |
| 18 |
lock |
| 19 |
xaddl %eax, (%rdi) |
| 20 |
incl %eax |
| 21 |
ret |
| 22 |
|
| 23 |
# PRInt32 __PR_Darwin_x86_64_AtomicDecrement(PRInt32 *val) |
| 24 |
# |
| 25 |
# Atomically decrement the integer pointed to by 'val' and return |
| 26 |
# the result of the decrement. |
| 27 |
# |
| 28 |
.text |
| 29 |
.globl __PR_Darwin_x86_64_AtomicDecrement |
| 30 |
.private_extern __PR_Darwin_x86_64_AtomicDecrement |
| 31 |
.align 4 |
| 32 |
__PR_Darwin_x86_64_AtomicDecrement: |
| 33 |
movl $-1, %eax |
| 34 |
lock |
| 35 |
xaddl %eax, (%rdi) |
| 36 |
decl %eax |
| 37 |
ret |
| 38 |
|
| 39 |
# PRInt32 __PR_Darwin_x86_64_AtomicSet(PRInt32 *val, PRInt32 newval) |
| 40 |
# |
| 41 |
# Atomically set the integer pointed to by 'val' to the new |
| 42 |
# value 'newval' and return the old value. |
| 43 |
# |
| 44 |
.text |
| 45 |
.globl __PR_Darwin_x86_64_AtomicSet |
| 46 |
.private_extern __PR_Darwin_x86_64_AtomicSet |
| 47 |
.align 4 |
| 48 |
__PR_Darwin_x86_64_AtomicSet: |
| 49 |
movl %esi, %eax |
| 50 |
xchgl %eax, (%rdi) |
| 51 |
ret |
| 52 |
|
| 53 |
# PRInt32 __PR_Darwin_x86_64_AtomicAdd(PRInt32 *ptr, PRInt32 val) |
| 54 |
# |
| 55 |
# Atomically add 'val' to the integer pointed to by 'ptr' |
| 56 |
# and return the result of the addition. |
| 57 |
# |
| 58 |
.text |
| 59 |
.globl __PR_Darwin_x86_64_AtomicAdd |
| 60 |
.private_extern __PR_Darwin_x86_64_AtomicAdd |
| 61 |
.align 4 |
| 62 |
__PR_Darwin_x86_64_AtomicAdd: |
| 63 |
movl %esi, %eax |
| 64 |
lock |
| 65 |
xaddl %eax, (%rdi) |
| 66 |
addl %esi, %eax |
| 67 |
ret |