--- SheepShaver/src/Unix/sysdeps.h 2004/01/26 13:52:31 1.23 +++ SheepShaver/src/Unix/sysdeps.h 2004/06/15 21:37:22 1.33 @@ -44,6 +44,10 @@ #include #include +#ifdef HAVE_PTHREADS +# include +#endif + #ifdef HAVE_FCNTL_H # include #endif @@ -68,8 +72,6 @@ #define POWERPC_ROM 1 #if EMULATED_PPC -// Handle interrupts asynchronously? -#define ASYNC_IRQ 0 // Mac ROM is write protected when banked memory is used #if REAL_ADDRESSING || DIRECT_ADDRESSING # define ROM_IS_WRITE_PROTECTED 0 @@ -78,12 +80,21 @@ # define ROM_IS_WRITE_PROTECTED 1 #endif // Configure PowerPC emulator -#define PPC_CHECK_INTERRUPTS (ASYNC_IRQ ? 0 : 1) +#define PPC_REENTRANT_JIT 1 +#define PPC_CHECK_INTERRUPTS 1 #define PPC_DECODE_CACHE 1 #define PPC_FLIGHT_RECORDER 1 #define PPC_PROFILE_COMPILE_TIME 0 #define PPC_PROFILE_GENERIC_CALLS 0 #define KPX_MAX_CPUS 1 +#if ENABLE_DYNGEN +// Don't bother with predecode cache when using JIT +#define PPC_ENABLE_JIT 1 +#undef PPC_DECODE_CACHE +#endif +#if defined(__i386__) +#define DYNGEN_ASM_OPTS 1 +#endif #else // Mac ROM is write protected #define ROM_IS_WRITE_PROTECTED 1 @@ -243,15 +254,15 @@ static inline int testandset(volatile in } #endif -#ifdef __i386__ +/* FIXME: SheepShaver occasionnally hangs with those locks */ +#if 0 && (defined(__i386__) || defined(__x86_64__)) #define HAVE_TEST_AND_SET 1 static inline int testandset(volatile int *p) { - int ret; - long int readval; + long int ret; /* Note: the "xchg" instruction does not need a "lock" prefix */ - __asm__ __volatile__("xchgl %0, %1" - : "=r" (ret), "=m" (*p), "=a" (readval) + __asm__ __volatile__("xchgl %k0, %1" + : "=r" (ret), "=m" (*p) : "0" (1), "m" (*p) : "memory"); return ret; @@ -323,12 +334,12 @@ static inline int testandset(volatile in #endif /* __GNUC__ */ -#if HAVE_TEST_AND_SET -#define HAVE_SPINLOCKS 1 typedef volatile int spinlock_t; static const spinlock_t SPIN_LOCK_UNLOCKED = 0; +#if HAVE_TEST_AND_SET +#define HAVE_SPINLOCKS 1 static inline void spin_lock(spinlock_t *lock) { while (testandset(lock)); @@ -343,6 +354,19 @@ static inline int spin_trylock(spinlock_ { return !testandset(lock); } +#else +static inline void spin_lock(spinlock_t *lock) +{ +} + +static inline void spin_unlock(spinlock_t *lock) +{ +} + +static inline int spin_trylock(spinlock_t *lock) +{ + return 1; +} #endif // Time data type for Time Manager emulation @@ -356,8 +380,10 @@ typedef struct timeval tm_time_t; extern uint64 GetTicks_usec(void); extern void Delay_usec(uint32 usec); +#if defined(HAVE_PTHREADS) || (defined(__linux__) && defined(__powerpc__)) // Setup pthread attributes extern void Set_pthread_attr(pthread_attr_t *attr, int priority); +#endif // Various definitions typedef struct rgb_color {