Changeset e762b43 in mainline for kernel/arch/arm32/include/atomic.h


Ignore:
Timestamp:
2009-03-03T16:12:43Z (16 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
02fd705
Parents:
f24d300
Message:

better inline assembler readability using the new symbolic syntax

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/arm32/include/atomic.h

    rf24d300 re762b43  
    2727 */
    2828
    29 /** @addtogroup arm32   
     29/** @addtogroup arm32
    3030 * @{
    3131 */
    32 /** @file 
     32/** @file
    3333 *  @brief Atomic operations.
    3434 */
     
    4343 *
    4444 * @return Value after addition.
     45 *
    4546 */
    4647static inline long atomic_add(atomic_t *val, int i)
     
    4849        int ret;
    4950        volatile long *mem = &(val->count);
    50 
     51       
    5152        asm volatile (
    52         "1:\n"
    53                 "ldr r2, [%1]       \n"
    54                 "add r3, r2, %2     \n"
    55                 "str r3, %0         \n"
    56                 "swp r3, r3, [%1]   \n"
    57                 "cmp r3, r2         \n"
    58                 "bne 1b             \n"
    59 
    60                 : "=m" (ret)
    61                 : "r" (mem), "r" (i)
     53                "1:\n"
     54                        "ldr r2, [%[mem]]\n"
     55                        "add r3, r2, %[i]\n"
     56                        "str r3, %[ret]\n"
     57                        "swp r3, r3, [%[mem]]\n"
     58                        "cmp r3, r2\n"
     59                        "bne 1b\n"
     60                : [ret] "=m" (ret)
     61                : [mem] "r" (mem), [i] "r" (i)
    6262                : "r3", "r2"
    6363        );
    64 
     64       
    6565        return ret;
    6666}
Note: See TracChangeset for help on using the changeset viewer.