/home/ntakagi/work/STLport-5.1.5/src/sparc_atomic.s

Go to the documentation of this file.
00001         .section        ".text",#alloc,#execinstr
00002           .align 8
00003           .skip 16
00004 
00005 
00006   /*
00007   **  int _STLP_atomic_exchange (void *pvalue, int value)
00008   */
00009 
00010           .type   _STLP_atomic_exchange,#function
00011           .global _STLP_atomic_exchange
00012           .align  8
00013 
00014 _STLP_atomic_exchange:
00015 0:
00016           ld      [%o0], %o2              ! Set the current value
00017           mov     %o1, %o3                ! Set the new value
00018 !          swap     [%o0], %o3             ! Do the compare and swap
00019           cas     [%o0], %o2, %o3
00020           cmp     %o2, %o3                ! Check whether successful
00021           bne     0b                      ! Retry upon failure
00022           stbar
00023           mov     %o2, %o0                ! Set the new value
00024           retl                            ! return
00025           nop
00026           .size   _STLP_atomic_exchange,(.-_STLP_atomic_exchange)
00027 
00028   /* int _STLP_atomic_increment (void *pvalue) */
00029 
00030           .type   _STLP_atomic_increment,#function
00031           .global _STLP_atomic_increment
00032           .align  8
00033 _STLP_atomic_increment:
00034 1:
00035           ld      [%o0], %o2              ! set the current
00036           add             %o2, 0x1, %o3                   ! Increment and store current
00037 !          swap     [%o0], %o3         ! Do the compare and swap
00038           cas     [%o0], %o2, %o3
00039           cmp     %o3, %o2                ! Check whether successful
00040           bne     1b                                         ! Retry if we failed.
00041           membar  #LoadLoad | #LoadStore  ! Ensure the cas finishes before
00042                                           ! returning
00043           nop
00044           retl                            ! return
00045           nop
00046 
00047           .size   _STLP_atomic_increment,(.-_STLP_atomic_increment)
00048 
00049 
00050   /* int _STLP_atomic_decrement (void *pvalue) */
00051           .type   _STLP_atomic_decrement,#function
00052           .global _STLP_atomic_decrement
00053           .align  8
00054 
00055 _STLP_atomic_decrement:
00056 2:
00057           ld      [%o0], %o2              ! set the current
00058           sub     %o2, 0x1, %o3                   ! decrement and store current
00059 !          swap    [%o0], %o3         ! Do the compare and swap
00060           cas     [%o0], %o2, %o3
00061           cmp     %o3, %o2                ! Check whether successful
00062           bne     2b                                         ! Retry if we failed.
00063           membar  #LoadLoad | #LoadStore  ! Ensure the cas finishes before
00064           nop
00065                                           ! returning
00066           retl                            ! return
00067           nop
00068           .size   _STLP_atomic_decrement,(.-_STLP_atomic_decrement)



Generated on Mon Mar 10 15:32:17 2008 by  doxygen 1.5.1