Debian Codegraph @

nsprpub/pr/src/md/unix/os_SunOS_x86_64.s

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