68 |
|
#define POWERPC_ROM 1 |
69 |
|
|
70 |
|
#if EMULATED_PPC |
71 |
+ |
// Handle interrupts asynchronously? |
72 |
+ |
#define ASYNC_IRQ 0 |
73 |
|
// Mac ROM is write protected when banked memory is used |
74 |
|
#if REAL_ADDRESSING || DIRECT_ADDRESSING |
75 |
|
# define ROM_IS_WRITE_PROTECTED 0 |
77 |
|
#else |
78 |
|
# define ROM_IS_WRITE_PROTECTED 1 |
79 |
|
#endif |
80 |
+ |
// Configure PowerPC emulator |
81 |
+ |
#define PPC_CHECK_INTERRUPTS (ASYNC_IRQ ? 0 : 1) |
82 |
+ |
#define PPC_DECODE_CACHE 1 |
83 |
+ |
#define PPC_FLIGHT_RECORDER 1 |
84 |
+ |
#define PPC_PROFILE_COMPILE_TIME 0 |
85 |
+ |
#define PPC_PROFILE_GENERIC_CALLS 0 |
86 |
+ |
#define KPX_MAX_CPUS 1 |
87 |
|
#else |
88 |
|
// Mac ROM is write protected |
89 |
|
#define ROM_IS_WRITE_PROTECTED 1 |
134 |
|
#error "Unsupported size of pointer" |
135 |
|
#endif |
136 |
|
|
137 |
< |
// Helper functions to byteswap data |
137 |
> |
/** |
138 |
> |
* Helper functions to byteswap data |
139 |
> |
**/ |
140 |
> |
|
141 |
> |
#if defined(__GNUC__) |
142 |
> |
#if defined(__x86_64__) |
143 |
> |
// Linux/AMD64 currently has no asm optimized bswap_32() in <byteswap.h> |
144 |
> |
#define opt_bswap_32 do_opt_bswap_32 |
145 |
> |
static inline uint32 do_opt_bswap_32(uint32 x) |
146 |
> |
{ |
147 |
> |
uint32 v; |
148 |
> |
__asm__ __volatile__ ("bswap %0" : "=r" (v) : "0" (x)); |
149 |
> |
return v; |
150 |
> |
} |
151 |
> |
#endif |
152 |
> |
#endif |
153 |
> |
|
154 |
|
#ifdef HAVE_BYTESWAP_H |
155 |
|
#include <byteswap.h> |
156 |
|
#endif |
157 |
|
|
158 |
+ |
#ifdef opt_bswap_16 |
159 |
+ |
#undef bswap_16 |
160 |
+ |
#define bswap_16 opt_bswap_16 |
161 |
+ |
#endif |
162 |
|
#ifndef bswap_16 |
163 |
|
#define bswap_16 generic_bswap_16 |
164 |
|
#endif |
168 |
|
return ((x & 0xff) << 8) | ((x >> 8) & 0xff); |
169 |
|
} |
170 |
|
|
171 |
+ |
#ifdef opt_bswap_32 |
172 |
+ |
#undef bswap_32 |
173 |
+ |
#define bswap_32 opt_bswap_32 |
174 |
+ |
#endif |
175 |
|
#ifndef bswap_32 |
176 |
|
#define bswap_32 generic_bswap_32 |
177 |
|
#endif |
184 |
|
((x & 0x000000ff) << 24) ); |
185 |
|
} |
186 |
|
|
187 |
+ |
#ifdef opt_bswap_64 |
188 |
+ |
#undef bswap_64 |
189 |
+ |
#define bswap_64 opt_bswap_64 |
190 |
+ |
#endif |
191 |
|
#ifndef bswap_64 |
192 |
|
#define bswap_64 generic_bswap_64 |
193 |
|
#endif |
319 |
|
#define HAVE_SPINLOCKS 1 |
320 |
|
typedef int spinlock_t; |
321 |
|
|
322 |
< |
const spinlock_t SPIN_LOCK_UNLOCKED = 0; |
322 |
> |
static const spinlock_t SPIN_LOCK_UNLOCKED = 0; |
323 |
|
|
324 |
|
static inline void spin_lock(spinlock_t *lock) |
325 |
|
{ |
344 |
|
typedef struct timeval tm_time_t; |
345 |
|
#endif |
346 |
|
|
347 |
+ |
// Timing functions |
348 |
+ |
extern uint64 GetTicks_usec(void); |
349 |
+ |
extern void Delay_usec(uint32 usec); |
350 |
+ |
|
351 |
|
// Setup pthread attributes |
352 |
|
extern void Set_pthread_attr(pthread_attr_t *attr, int priority); |
353 |
|
|