Wrong spinlock implementation for Tricore?

Forum related to ERIKA Enterprise and RT-Druid version 2

Moderator: paolo.gai

Post Reply
dcompagn
Newbie
Posts: 3
Joined: Thu Sep 17, 2015 9:50 am

Wrong spinlock implementation for Tricore?

Post by dcompagn » Tue Mar 15, 2016 2:34 pm

Hi all,

I'm facing some problem using "EE_tc_sync_barrier" to synchronize the task execution.
Can that function be used inside tasks or just in the kernel?

I'd just like to be sure the spinlock mechanism, used in barriers, has been correctly implemented.
The current implementation rely on the atomicity of the CMPSWAP.W instruction, but this information is missing in the instruction set manual.
Conversely, the manual claims the atomicity for the LDMST and SWAP.W instructions.
Could someone confirm this?

Thanks in advance,
Davide

e.guidieri
Full Member
Posts: 166
Joined: Tue May 10, 2011 2:05 pm

Re: Wrong spinlock implementation for Tricore?

Post by e.guidieri » Tue Mar 22, 2016 2:24 pm

2.4 Semaphores and Atomic Operations
The TriCore architecture has five instructions which read and/or write memory in atomic
fashion:
• LDMST (Load, Modify, Store)
• SWAP.W (Swap register with memory)
• ST.T (Store bit)
CMPSWAP.W
• SWAPMSK.W
...
You have an old version of AURIX ISA Reference Manual, get the new one.

And I'm happy that this is the reason, because a compare and swap instrution without atomicity is meaningless.

Errico

Post Reply