~ubuntu-branches/ubuntu/intrepid/ecl/intrepid

« back to all changes in this revision

Viewing changes to src/gc/include/private/gc_locks.h

  • Committer: Bazaar Package Importer
  • Author(s): Peter Van Eynde
  • Date: 2006-06-21 09:21:21 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20060621092121-txz1f21lj0wh0f67
Tags: 0.9h-20060617-1
* New upstream version
* Updated standards version without real changes. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
155
155
#      define GC_TEST_AND_SET_DEFINED
156
156
#    endif
157
157
#    if defined(POWERPC)
158
 
#     if CPP_WORDSZ == 64
159
 
        inline static int GC_test_and_set(volatile unsigned int *addr) {
160
 
          unsigned long oldval;
161
 
          unsigned long temp = 1; /* locked value */
162
 
 
163
 
          __asm__ __volatile__(
164
 
               "1:\tldarx %0,0,%3\n"   /* load and reserve               */
165
 
               "\tcmpdi %0, 0\n"       /* if load is                     */
166
 
               "\tbne 2f\n"            /*   non-zero, return already set */
167
 
               "\tstdcx. %2,0,%1\n"    /* else store conditional         */
168
 
               "\tbne- 1b\n"           /* retry if lost reservation      */
169
 
               "\tsync\n"              /* import barrier                 */
170
 
               "2:\t\n"                /* oldval is zero if we set       */
171
 
              : "=&r"(oldval), "=p"(addr)
172
 
              : "r"(temp), "1"(addr)
173
 
              : "cr0","memory");
174
 
          return (int)oldval;
175
 
        }
176
 
#     else
177
158
        inline static int GC_test_and_set(volatile unsigned int *addr) {
178
159
          int oldval;
179
160
          int temp = 1; /* locked value */
191
172
              : "cr0","memory");
192
173
          return oldval;
193
174
        }
194
 
#     endif
195
175
#     define GC_TEST_AND_SET_DEFINED
196
176
      inline static void GC_clear(volatile unsigned int *addr) {
197
177
        __asm__ __volatile__("lwsync" : : : "memory");
239
219
#    ifdef ARM32
240
220
        inline static int GC_test_and_set(volatile unsigned int *addr) {
241
221
          int oldval;
242
 
          /* SWP on ARM is very similar to XCHG on x86.  Doesn't lock the
243
 
           * bus because there are no SMP ARM machines.  If/when there are,
244
 
           * this code will likely need to be updated. */
245
 
          /* See linuxthreads/sysdeps/arm/pt-machine.h in glibc-2.1 */
246
 
          __asm__ __volatile__("swp %0, %1, [%2]"
247
 
                             : "=r"(oldval)
248
 
                             : "r"(1), "r"(addr)
249
 
                             : "memory");
 
222
          /* SWP on ARM is very similar to XCHG on x86.                 */
 
223
          /* The first operand is the result, the second the value      */
 
224
          /* to be stored.  Both registers must be different from addr. */
 
225
          /* Make the address operand an early clobber output so it     */
 
226
          /* doesn't overlap with the other operands.  The early clobber*/
 
227
          /* on oldval is neccessary to prevent the compiler allocating */
 
228
          /* them to the same register if they are both unused.         */
 
229
          __asm__ __volatile__("swp %0, %2, [%3]"
 
230
                             : "=&r"(oldval), "=&r"(addr)
 
231
                             : "r"(1), "1"(addr)
 
232
                             : "memory");
250
233
          return oldval;
251
234
        }
252
235
#       define GC_TEST_AND_SET_DEFINED