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

branch
TOR_BUG_3246
changeset 5
4ab42b5ab56c
equal deleted inserted replaced
-1:000000000000 0:a3653a14d425
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 #
8 # Based on the programming examples in The PowerPC Architecture:
9 # A Specification for A New Family of RISC Processors, 2nd Ed.,
10 # Book I, Section E.1, "Synchronization," pp. 249-256, May 1994.
11 #
12
13 .section ".text"
14
15 #
16 # PRInt32 _PR_ppc_AtomicIncrement(PRInt32 *val);
17 #
18 .align 2
19 .globl _PR_ppc_AtomicIncrement
20 .type _PR_ppc_AtomicIncrement,@function
21 _PR_ppc_AtomicIncrement:
22 .Lfd1: lwarx 4,0,3
23 addi 0,4,1
24 stwcx. 0,0,3
25 bne- .Lfd1
26 mr 3,0
27 blr
28 .Lfe1: .size _PR_ppc_AtomicIncrement,.Lfe1-_PR_ppc_AtomicIncrement
29
30 #
31 # PRInt32 _PR_ppc_AtomicDecrement(PRInt32 *val);
32 #
33 .align 2
34 .globl _PR_ppc_AtomicDecrement
35 .type _PR_ppc_AtomicDecrement,@function
36 _PR_ppc_AtomicDecrement:
37 .Lfd2: lwarx 4,0,3
38 addi 0,4,-1
39 stwcx. 0,0,3
40 bne- .Lfd2
41 mr 3,0
42 blr
43 .Lfe2: .size _PR_ppc_AtomicDecrement,.Lfe2-_PR_ppc_AtomicDecrement
44
45 #
46 # PRInt32 _PR_ppc_AtomicSet(PRInt32 *val, PRInt32 newval);
47 #
48 .align 2
49 .globl _PR_ppc_AtomicSet
50 .type _PR_ppc_AtomicSet,@function
51 _PR_ppc_AtomicSet:
52 .Lfd3: lwarx 5,0,3
53 stwcx. 4,0,3
54 bne- .Lfd3
55 mr 3,5
56 blr
57 .Lfe3: .size _PR_ppc_AtomicSet,.Lfe3-_PR_ppc_AtomicSet
58
59 #
60 # PRInt32 _PR_ppc_AtomicAdd(PRInt32 *ptr, PRInt32 val);
61 #
62 .align 2
63 .globl _PR_ppc_AtomicAdd
64 .type _PR_ppc_AtomicAdd,@function
65 _PR_ppc_AtomicAdd:
66 .Lfd4: lwarx 5,0,3
67 add 0,4,5
68 stwcx. 0,0,3
69 bne- .Lfd4
70 mr 3,0
71 blr
72 .Lfe4: .size _PR_ppc_AtomicAdd,.Lfe4-_PR_ppc_AtomicAdd
73
74 # Magic indicating no need for an executable stack
75 .section .note.GNU-stack, "", @progbits ; .previous

mercurial