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