30 |
|
#include "sigsegv.h" |
31 |
|
#include "cpu/ppc/ppc-cpu.hpp" |
32 |
|
#include "cpu/ppc/ppc-operations.hpp" |
33 |
+ |
#include "cpu/ppc/ppc-instructions.hpp" |
34 |
|
|
35 |
|
// Used for NativeOp trampolines |
36 |
|
#include "video.h" |
93 |
|
// SIGSEGV handler |
94 |
|
static sigsegv_return_t sigsegv_handler(sigsegv_address_t, sigsegv_address_t); |
95 |
|
|
96 |
+ |
// JIT Compiler enabled? |
97 |
+ |
static inline bool enable_jit_p() |
98 |
+ |
{ |
99 |
+ |
return PrefsFindBool("jit"); |
100 |
+ |
} |
101 |
+ |
|
102 |
|
|
103 |
|
/** |
104 |
|
* PowerPC emulator glue with special 'sheep' opcodes |
105 |
|
**/ |
106 |
|
|
107 |
+ |
enum { |
108 |
+ |
PPC_I(SHEEP) = PPC_I(MAX), |
109 |
+ |
PPC_I(SHEEP_MAX) |
110 |
+ |
}; |
111 |
+ |
|
112 |
|
class sheepshaver_cpu |
113 |
|
: public powerpc_cpu |
114 |
|
{ |
124 |
|
uint32 get_cr() const { return cr().get(); } |
125 |
|
void set_cr(uint32 v) { cr().set(v); } |
126 |
|
|
115 |
– |
// Execution loop |
116 |
– |
void execute(uint32 entry, bool enable_cache = false); |
117 |
– |
|
127 |
|
// Execute 68k routine |
128 |
|
void execute_68k(uint32 entry, M68kRegisters *r); |
129 |
|
|
156 |
|
lazy_allocator< sheepshaver_cpu > allocator_helper< sheepshaver_cpu, lazy_allocator >::allocator; |
157 |
|
|
158 |
|
sheepshaver_cpu::sheepshaver_cpu() |
159 |
< |
: powerpc_cpu() |
159 |
> |
: powerpc_cpu(enable_jit_p()) |
160 |
|
{ |
161 |
|
init_decoder(); |
162 |
|
} |
174 |
|
{ "sheep", |
175 |
|
(execute_pmf)&sheepshaver_cpu::execute_sheep, |
176 |
|
NULL, |
177 |
+ |
PPC_I(SHEEP), |
178 |
|
D_form, 6, 0, CFLOW_JUMP | CFLOW_TRAP |
179 |
|
} |
180 |
|
}; |
247 |
|
} |
248 |
|
} |
249 |
|
|
240 |
– |
// Execution loop |
241 |
– |
void sheepshaver_cpu::execute(uint32 entry, bool enable_cache) |
242 |
– |
{ |
243 |
– |
powerpc_cpu::execute(entry, enable_cache); |
244 |
– |
} |
245 |
– |
|
250 |
|
// Handle MacOS interrupt |
251 |
|
void sheepshaver_cpu::interrupt(uint32 entry) |
252 |
|
{ |
683 |
|
current_cpu->start_log(); |
684 |
|
#endif |
685 |
|
// start emulation loop and enable code translation or caching |
686 |
< |
current_cpu->execute(entry, true); |
686 |
> |
current_cpu->execute(entry); |
687 |
|
} |
688 |
|
|
689 |
|
/* |