Wed, 31 Dec 2014 07:53:36 +0100
Correct small whitespace inconsistency, lost while renaming variables.
michael@0 | 1 | # -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
michael@0 | 2 | # |
michael@0 | 3 | # This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | # License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
michael@0 | 6 | |
michael@0 | 7 | # |
michael@0 | 8 | # Based on the programming examples in The PowerPC Architecture: |
michael@0 | 9 | # A Specification for A New Family of RISC Processors, 2nd Ed., |
michael@0 | 10 | # Book I, Section E.1, "Synchronization," pp. 249-256, May 1994. |
michael@0 | 11 | # |
michael@0 | 12 | |
michael@0 | 13 | .text |
michael@0 | 14 | |
michael@0 | 15 | # |
michael@0 | 16 | # PRInt32 __PR_DarwinPPC_AtomicIncrement(PRInt32 *val); |
michael@0 | 17 | # |
michael@0 | 18 | .align 2 |
michael@0 | 19 | .globl __PR_DarwinPPC_AtomicIncrement |
michael@0 | 20 | .private_extern __PR_DarwinPPC_AtomicIncrement |
michael@0 | 21 | __PR_DarwinPPC_AtomicIncrement: |
michael@0 | 22 | lwarx r4,0,r3 |
michael@0 | 23 | addi r0,r4,1 |
michael@0 | 24 | stwcx. r0,0,r3 |
michael@0 | 25 | bne- __PR_DarwinPPC_AtomicIncrement |
michael@0 | 26 | mr r3,r0 |
michael@0 | 27 | blr |
michael@0 | 28 | |
michael@0 | 29 | # |
michael@0 | 30 | # PRInt32 __PR_DarwinPPC_AtomicDecrement(PRInt32 *val); |
michael@0 | 31 | # |
michael@0 | 32 | .align 2 |
michael@0 | 33 | .globl __PR_DarwinPPC_AtomicDecrement |
michael@0 | 34 | .private_extern __PR_DarwinPPC_AtomicDecrement |
michael@0 | 35 | __PR_DarwinPPC_AtomicDecrement: |
michael@0 | 36 | lwarx r4,0,r3 |
michael@0 | 37 | addi r0,r4,-1 |
michael@0 | 38 | stwcx. r0,0,r3 |
michael@0 | 39 | bne- __PR_DarwinPPC_AtomicDecrement |
michael@0 | 40 | mr r3,r0 |
michael@0 | 41 | blr |
michael@0 | 42 | |
michael@0 | 43 | # |
michael@0 | 44 | # PRInt32 __PR_DarwinPPC_AtomicSet(PRInt32 *val, PRInt32 newval); |
michael@0 | 45 | # |
michael@0 | 46 | .align 2 |
michael@0 | 47 | .globl __PR_DarwinPPC_AtomicSet |
michael@0 | 48 | .private_extern __PR_DarwinPPC_AtomicSet |
michael@0 | 49 | __PR_DarwinPPC_AtomicSet: |
michael@0 | 50 | lwarx r5,0,r3 |
michael@0 | 51 | stwcx. r4,0,r3 |
michael@0 | 52 | bne- __PR_DarwinPPC_AtomicSet |
michael@0 | 53 | mr r3,r5 |
michael@0 | 54 | blr |
michael@0 | 55 | |
michael@0 | 56 | # |
michael@0 | 57 | # PRInt32 __PR_DarwinPPC_AtomicAdd(PRInt32 *ptr, PRInt32 val); |
michael@0 | 58 | # |
michael@0 | 59 | .align 2 |
michael@0 | 60 | .globl __PR_DarwinPPC_AtomicAdd |
michael@0 | 61 | .private_extern __PR_DarwinPPC_AtomicAdd |
michael@0 | 62 | __PR_DarwinPPC_AtomicAdd: |
michael@0 | 63 | lwarx r5,0,r3 |
michael@0 | 64 | add r0,r4,r5 |
michael@0 | 65 | stwcx. r0,0,r3 |
michael@0 | 66 | bne- __PR_DarwinPPC_AtomicAdd |
michael@0 | 67 | mr r3,r0 |
michael@0 | 68 | blr |