(file) Return to sunsparc8_atomic.s CVS log (file) (dir) Up to [OMI] / omi / base

File: [OMI] / omi / base / sunsparc8_atomic.s (download)
Revision: 1.1, Wed May 30 21:47:49 2012 UTC (12 years ago) by mike
Branch: MAIN
Initial revision

!------------------------------------------------------------------------------
!    Copyright (c) Microsoft Corporation.  All rights reserved.
!
! Provides assembler funcions needed for SUN sparc atomic functions.    
! Date        05-sep-08

.section   ".text"
.global   AtomicIncrement
.align   4

AtomicIncrement:             

1:      ld      [%o0], %o1          ! load the current value
        add     %o1, 1, %o2         ! perform required operation
        cas     [%o0], %o1, %o2     ! try CAS
        cmp     %o1, %o2            ! check if result is expected one
        bne     1b                  ! try again if not
        nop
        retl
        add     %o2, 1, %o0         ! return new value         


.type  AtomicIncrement,#function
.size  AtomicIncrement,.-AtomicIncrement


.section   ".text"
.global   AtomicDecrement
.align   4

AtomicDecrement:             

1:      ld      [%o0], %o1          ! load the current value
        sub     %o1, 1, %o2         ! perform required operation
        cas     [%o0], %o1, %o2     ! try CAS
        cmp     %o1, %o2            ! check if result is expected one
        bne     1b                  ! try again if not
        nop
        retl
        sub     %o2, 1, %o0         ! return new value

.type  AtomicDecrement,#function
.size  AtomicDecrement,.-AtomicDecrement

        

ViewCVS 0.9.2