ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/SheepShaver/src/Unix/sysdeps.h
(Generate patch)

Comparing SheepShaver/src/Unix/sysdeps.h (file contents):
Revision 1.30 by gbeauche, 2004-05-20T12:33:57Z vs.
Revision 1.32 by gbeauche, 2004-06-02T16:11:49Z

# Line 249 | Line 249 | static inline int testandset(volatile in
249   }
250   #endif
251  
252 < #ifdef __i386__
252 > /* FIXME: SheepShaver occasionnally hangs with those locks */
253 > #if 0 && (defined(__i386__) || defined(__x86_64__))
254   #define HAVE_TEST_AND_SET 1
255   static inline int testandset(volatile int *p)
256   {
257 <        int ret;
257 <        long int readval;
257 >        long int ret;
258          /* Note: the "xchg" instruction does not need a "lock" prefix */
259 <        __asm__ __volatile__("xchgl %0, %1"
260 <                                                 : "=r" (ret), "=m" (*p), "=a" (readval)
259 >        __asm__ __volatile__("xchgl %k0, %1"
260 >                                                 : "=r" (ret), "=m" (*p)
261                                                   : "0" (1), "m" (*p)
262                                                   : "memory");
263          return ret;
# Line 329 | Line 329 | static inline int testandset(volatile in
329  
330   #endif /* __GNUC__ */
331  
332 #if HAVE_TEST_AND_SET
333 #define HAVE_SPINLOCKS 1
332   typedef volatile int spinlock_t;
333  
334   static const spinlock_t SPIN_LOCK_UNLOCKED = 0;
335  
336 + #if HAVE_TEST_AND_SET
337 + #define HAVE_SPINLOCKS 1
338   static inline void spin_lock(spinlock_t *lock)
339   {
340          while (testandset(lock));
# Line 349 | Line 349 | static inline int spin_trylock(spinlock_
349   {
350          return !testandset(lock);
351   }
352 + #else
353 + static inline void spin_lock(spinlock_t *lock)
354 + {
355 + }
356 +
357 + static inline void spin_unlock(spinlock_t *lock)
358 + {
359 + }
360 +
361 + static inline int spin_trylock(spinlock_t *lock)
362 + {
363 +        return 1;
364 + }
365   #endif
366  
367   // Time data type for Time Manager emulation

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines