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 |
|
#else |
85 |
|
// Mac ROM is write protected |
86 |
|
#define ROM_IS_WRITE_PROTECTED 1 |
131 |
|
#error "Unsupported size of pointer" |
132 |
|
#endif |
133 |
|
|
134 |
< |
// Helper functions to byteswap data |
134 |
> |
/** |
135 |
> |
* Helper functions to byteswap data |
136 |
> |
**/ |
137 |
> |
|
138 |
> |
#if defined(__GNUC__) |
139 |
> |
#if defined(__x86_64__) |
140 |
> |
// Linux/AMD64 currently has no asm optimized bswap_32() in <byteswap.h> |
141 |
> |
#define opt_bswap_32 do_opt_bswap_32 |
142 |
> |
static inline uint32 do_opt_bswap_32(uint32 x) |
143 |
> |
{ |
144 |
> |
uint32 v; |
145 |
> |
__asm__ __volatile__ ("bswap %0" : "=r" (v) : "0" (x)); |
146 |
> |
return v; |
147 |
> |
} |
148 |
> |
#endif |
149 |
> |
#endif |
150 |
> |
|
151 |
|
#ifdef HAVE_BYTESWAP_H |
152 |
|
#include <byteswap.h> |
153 |
|
#endif |
154 |
|
|
155 |
+ |
#ifdef opt_bswap_16 |
156 |
+ |
#undef bswap_16 |
157 |
+ |
#define bswap_16 opt_bswap_16 |
158 |
+ |
#endif |
159 |
|
#ifndef bswap_16 |
160 |
|
#define bswap_16 generic_bswap_16 |
161 |
|
#endif |
165 |
|
return ((x & 0xff) << 8) | ((x >> 8) & 0xff); |
166 |
|
} |
167 |
|
|
168 |
+ |
#ifdef opt_bswap_32 |
169 |
+ |
#undef bswap_32 |
170 |
+ |
#define bswap_32 opt_bswap_32 |
171 |
+ |
#endif |
172 |
|
#ifndef bswap_32 |
173 |
|
#define bswap_32 generic_bswap_32 |
174 |
|
#endif |
181 |
|
((x & 0x000000ff) << 24) ); |
182 |
|
} |
183 |
|
|
184 |
+ |
#ifdef opt_bswap_64 |
185 |
+ |
#undef bswap_64 |
186 |
+ |
#define bswap_64 opt_bswap_64 |
187 |
+ |
#endif |
188 |
|
#ifndef bswap_64 |
189 |
|
#define bswap_64 generic_bswap_64 |
190 |
|
#endif |
316 |
|
#define HAVE_SPINLOCKS 1 |
317 |
|
typedef int spinlock_t; |
318 |
|
|
319 |
< |
const spinlock_t SPIN_LOCK_UNLOCKED = 0; |
319 |
> |
static const spinlock_t SPIN_LOCK_UNLOCKED = 0; |
320 |
|
|
321 |
|
static inline void spin_lock(spinlock_t *lock) |
322 |
|
{ |