Ticket #11121: Set-return-value-of-atomic_get_and_set.patch

File Set-return-value-of-atomic_get_and_set.patch, 1.0 KB (added by arvindsraj, 10 years ago)
  • src/system/libroot/os/arch/arm/atomic.S

    From 3371f81482067d8fa993d6385a78919b647b30c3 Mon Sep 17 00:00:00 2001
    From: Arvind S Raj <sraj.arvind@gmail.com>
    Date: Tue, 12 Aug 2014 20:02:38 +0530
    Subject: [PATCH] Set return value of atomic_get_and_set to prevent a double
     spinlock acquire when booting which causes KDL. Also some style fixes have
     been made.
    
    ---
     src/system/libroot/os/arch/arm/atomic.S | 9 +++++----
     1 file changed, 5 insertions(+), 4 deletions(-)
    
    diff --git a/src/system/libroot/os/arch/arm/atomic.S b/src/system/libroot/os/arch/arm/atomic.S
    index 5728e5c..a2f93a0 100644
    a b FUNCTION_END(atomic_set)  
    5858 */
    5959FUNCTION(atomic_get_and_set):
    6060miss4:      ldrex   r12, [r0]
    61             strex   r3, r1, [r0]
    62             teq     r3, #0
    63             bne     miss4
    64             bx  lr
     61        strex   r3, r1, [r0]
     62        teq     r3, #0
     63        bne     miss4
     64        mov     r0, r12
     65        bx  lr
    6566FUNCTION_END(atomic_get_and_set)
    6667
    6768/* int atomic_test_and_set(int *value, int setTo, int testValue)