答复: [ECOS] cortex a9 SMP spinlock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


Hi,Christophe

For HAL_TAS_SET( _tas_, _oldb_ ), the "strexeq  %0,r1,[%1]\n" will save the store operation's state(failed or succeeded) to register %0(i.e. _oldb_).
For HAL_TAS_CLEAR( _tas_, _oldb_ ), because the processor owned the spinlock can process this marco, so the store operation will succeed certainly.So, no need to check the store operation state.
what's your opinion?

BR
Jerry 
________________________________________
发件人: Christophe Coutand [ccoutand@xxxxxxxx]
发送时间: 2011年1月31日 16:44
收件人: Fan Chongbin-B32609; ecos-discuss@xxxxxxxxxxxxxxxxxxx
主题: RE:  cortex a9 SMP spinlock

You must make sure that your store operation has succeeded. It applies for both the set and clear.

Christophe

-----Original Message-----
From: Fan Chongbin-B32609 [mailto:B32609@xxxxxxxxxxxxx]
Sent: 31. januar 2011 06:12
To: Christophe Coutand; ecos-discuss@xxxxxxxxxxxxxxxxxxx
Subject: RE:  cortex a9 SMP spinlock

My implementation:

#define HAL_TAS_SET( _tas_, _oldb_ )                    \
CYG_MACRO_START                                         \
{                                                       \
    register CYG_WORD32 __old;                          \
    register CYG_WORD32 __tas = &_tas_;                 \
    __asm__ volatile (                                  \
                        "mov r1,#1\n"                                           \
                        "ldrex r0,[%1]\n"                       \
                                                                        "cmp r0,#0"                                                                                     \
                        "strexeq  %0,r1,[%1]\n"         \
                        : "=r" (__old), "=r" (__tas),   \
                        :                               \
                        : "memory","r1","r0"            \
                     );                                 \
    _oldb_ = ( __old & 1 ) != 0;                        \
}                                                       \
CYG_MACRO_END

#define HAL_TAS_CLEAR( _tas_, _oldb_ )                  \
CYG_MACRO_START                                         \
{                                                       \
    register CYG_WORD32 __tas = &_tas_;                                                                 \
    __asm__ volatile (                                  \
                        " mov r1,#0\n"                                  \
                        " str r1,[%0]\n"                \
                                                " dsb\n"                                                                                                \
                        : "=r" (__tas)                                                                  \
                        :                               \
                        : "memory","r1"                 \
                     );                                 \
}                                                       \
CYG_MACRO_END

Because of the lack of the real target board, I did not know it worked or not. So, guys, give me some advice.


BR
Jerry
-----Original Message-----
From: Christophe Coutand [mailto:ccoutand@xxxxxxxx]
Sent: 2011年1月30日 17:57
To: Fan Chongbin-B32609; ecos-discuss@xxxxxxxxxxxxxxxxxxx
Subject: RE:  cortex a9 SMP spinlock

You can find some inputs here:

http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0489b/Cih
bghef.html

Christophe

-----Original Message-----
From: ecos-discuss-owner@xxxxxxxxxxxxxxxxxxx
[mailto:ecos-discuss-owner@xxxxxxxxxxxxxxxxxxx] On Behalf Of Fan
Chongbin-B32609
Sent: 30. januar 2011 10:31
To: ecos-discuss@xxxxxxxxxxxxxxxxxxx
Subject:  cortex a9 SMP spinlock

Hi, all
  For cortex-a9 SMP, how to implement HAL_TAS_SET(_tas, _oldb_) macro?

BR
Jerry


--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss






[Search]     [Linux Embedded]     [U-Boot V2]     [Linux Kernel]     [Linux MIPS]     [Linux ARM]     [Linux for the Blind]     [Linux Resources]     [Photo]     [Yosemite]     [ISDN Cause Codes]     [ECOS Home]     [Site Home]

Add to Google Powered by Linux