diff options
| author | Andreas Monzner <andreas.monzner@multimedia-labs.de> | 2006-07-04 12:06:02 +0000 |
|---|---|---|
| committer | Andreas Monzner <andreas.monzner@multimedia-labs.de> | 2006-07-04 12:06:02 +0000 |
| commit | 4b6f19109cd4bbab23af49e953537d1919348a0a (patch) | |
| tree | b17f90132080ee69e48abf9cd1d1b4bedcd00745 /lib/base | |
| parent | 5b5c4c643d1c2cb1a3949bca4a36d4abcae170cd (diff) | |
| download | enigma2-4b6f19109cd4bbab23af49e953537d1919348a0a.tar.gz enigma2-4b6f19109cd4bbab23af49e953537d1919348a0a.zip | |
add atomic versions of AddRef / Release for ppc .. used by refcounting
'/home/ghost/hdb/7025_rootfs/enigma2-1.0-r0/enigma2/lib/base'
Diffstat (limited to 'lib/base')
| -rw-r--r-- | lib/base/object.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/base/object.h b/lib/base/object.h index f93f4257..38a6dd35 100644 --- a/lib/base/object.h +++ b/lib/base/object.h @@ -79,6 +79,40 @@ public: if (!ref) \ delete this; \ } + #elif defined(__ppc__) + #define DECLARE_REF(x) \ + private: oRefCount ref; \ + public: void AddRef(); \ + void Release(); + #define DEFINE_REF(c) \ + void c::AddRef() \ + { \ + int temp; \ + __asm__ __volatile__( \ + "1: lwarx %0, 0, %3 \n" \ + " add %0, %2, %0 \n" \ + " dcbt 0, %3 \n" \ + " stwcx. %0, 0, %3 \n" \ + " bne- 1b \n" \ + : "=&r" (temp), "=m" ((int)ref) \ + : "r" (1), "r" (&((int)ref)), "m" ((int)ref) \ + : "cc"); \ + } \ + void c::Release() \ + { \ + int temp; \ + __asm__ __volatile__( \ + "1: lwarx %0, 0, %3 \n" \ + " subf %0, %2, %0 \n" \ + " dcbt 0, %3 \n" \ + " stwcx. %0, 0, %3 \n" \ + " bne- 1b \n" \ + : "=&r" (temp), "=m" ((int)ref) \ + : "r" (1), "r" (&((int)ref)), "m" ((int)ref) \ + : "cc"); \ + if (!ref) \ + delete this; \ + } #else #define DECLARE_REF(x) \ private:oRefCount ref; \ |
