Browse Source

Valerio Pilo CAS for ARMv7 patch.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@4117 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/1.9.7
sletz 14 years ago
parent
commit
f1083cbf42
2 changed files with 51 additions and 2 deletions
  1. +6
    -1
      ChangeLog
  2. +45
    -1
      linux/JackAtomic_os.h

+ 6
- 1
ChangeLog View File

@@ -27,12 +27,17 @@ Mario Lang
Arnold Krille
Jan Engelhardt
Adrian Knoth
David Garcia Garzon
David Garcia Garzon
Valerio Pilo
---------------------------
Jackdmp changes log
---------------------------

2011-02-03 Stephane Letz <letz@grame.fr>

* Valerio Pilo CAS for ARMv7 patch.

2011-01-11 Stephane Letz <letz@grame.fr>

* Adrian Knoth jack_lsp patch.


+ 45
- 1
linux/JackAtomic_os.h View File

@@ -69,7 +69,51 @@ static inline char CAS(volatile UInt32 value, UInt32 newvalue, volatile void* ad

#endif

#if !defined(__i386__) && !defined(__x86_64__) && !defined(__PPC__)


#if defined(__thumb__)
/*
* This Compare And Swap code is based off the version found
* in MutekH, http://www.mutekh.org/trac/mutekh
*
* Copyright Alexandre Becoulet <alexandre.becoulet@lip6.fr> (c) 2006
*/

static inline char CAS(volatile UInt32 value, UInt32 newvalue, volatile void* addr)
{
UInt32 tmp, loaded;
UInt32 thumb_tmp;

asm volatile(
".align 2 \n\t"
"mov %[adr], pc \n\t"
"add %[adr], %[adr], #4 \n\t"
"bx %[adr] \n\t"
"nop \n\t"
".arm \n\t"
"1: \n\t"
"ldrex %[loaded], [%[atomic]] \n\t"
"cmp %[loaded], %[value] \n\t"
"bne 2f \n\t"
"strex %[tmp], %[newvalue], [%[atomic]] \n\t"
"tst %[tmp], #1 \n\t"
"bne 1b \n\t"
"2: \n\t"
"add %[adr], pc, #1 \n\t"
"bx %[adr] \n\t"
: [tmp] "=&r" (tmp), [loaded] "=&r" (loaded), "=m" (*(volatile UInt32*)addr)
, [adr] "=&l" (thumb_tmp)
: [value] "r" (value), [newvalue] "r" (newvalue), [atomic] "r" (addr)
);

return loaded == value;
}

#endif



#if !defined(__i386__) && !defined(__x86_64__) && !defined(__PPC__) && !defined(__thumb__)
#warning using builtin gcc (version > 4.1) atomic

static inline char CAS(volatile UInt32 value, UInt32 newvalue, volatile void* addr)


Loading…
Cancel
Save