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.22 by gbeauche, 2004-01-18T22:05:28Z vs.
Revision 1.32 by gbeauche, 2004-06-02T16:11:49Z

# Line 44 | Line 44
44   #include <string.h>
45   #include <signal.h>
46  
47 + #ifdef HAVE_PTHREADS
48 + # include <pthread.h>
49 + #endif
50 +
51   #ifdef HAVE_FCNTL_H
52   # include <fcntl.h>
53   #endif
# Line 68 | Line 72
72   #define POWERPC_ROM 1
73  
74   #if EMULATED_PPC
71 // Handle interrupts asynchronously?
72 #define ASYNC_IRQ 0
75   // Mac ROM is write protected when banked memory is used
76   #if REAL_ADDRESSING || DIRECT_ADDRESSING
77   # define ROM_IS_WRITE_PROTECTED 0
# Line 78 | Line 80
80   # define ROM_IS_WRITE_PROTECTED 1
81   #endif
82   // Configure PowerPC emulator
83 < #define PPC_CHECK_INTERRUPTS (ASYNC_IRQ ? 0 : 1)
83 > #define PPC_REENTRANT_JIT 1
84 > #define PPC_CHECK_INTERRUPTS 1
85   #define PPC_DECODE_CACHE 1
86   #define PPC_FLIGHT_RECORDER 1
87   #define PPC_PROFILE_COMPILE_TIME 0
88   #define PPC_PROFILE_GENERIC_CALLS 0
89   #define KPX_MAX_CPUS 1
90 + #if defined(__i386__)
91 + #define DYNGEN_ASM_OPTS 1
92 + #endif
93   #else
94   // Mac ROM is write protected
95   #define ROM_IS_WRITE_PROTECTED 1
# Line 139 | Line 145 | typedef int64 intptr;
145   **/
146  
147   #if defined(__GNUC__)
148 < #if defined(__x86_64__)
148 > #if defined(__x86_64__) || defined(__i386__)
149   // Linux/AMD64 currently has no asm optimized bswap_32() in <byteswap.h>
150   #define opt_bswap_32 do_opt_bswap_32
151   static inline uint32 do_opt_bswap_32(uint32 x)
# Line 184 | Line 190 | static inline uint32 generic_bswap_32(ui
190                    ((x & 0x000000ff) << 24) );
191   }
192  
193 + #if defined(__i386__)
194 + #define opt_bswap_64 do_opt_bswap_64
195 + static inline uint64 do_opt_bswap_64(uint64 x)
196 + {
197 +  return (bswap_32(x >> 32) | (((uint64)bswap_32((uint32)x)) << 32));
198 + }
199 + #endif
200 +
201   #ifdef  opt_bswap_64
202   #undef  bswap_64
203   #define bswap_64 opt_bswap_64
# Line 235 | 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;
243 <        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 315 | Line 329 | static inline int testandset(volatile in
329  
330   #endif /* __GNUC__ */
331  
318 #if HAVE_TEST_AND_SET
319 #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 335 | 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
# Line 348 | Line 375 | typedef struct timeval tm_time_t;
375   extern uint64 GetTicks_usec(void);
376   extern void Delay_usec(uint32 usec);
377  
378 + #if defined(HAVE_PTHREADS) || (defined(__linux__) && defined(__powerpc__))
379   // Setup pthread attributes
380   extern void Set_pthread_attr(pthread_attr_t *attr, int priority);
381 + #endif
382  
383   // Various definitions
384   typedef struct rgb_color {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines