- Add support for FLIGHT_RECORDER with predecode cache

- Always enable predecode cache & flight recorder for now
This commit is contained in:
gbeauche 2003-10-11 09:57:52 +00:00
parent b05c68e90e
commit 7e20a8d205
4 changed files with 33 additions and 5 deletions

View File

@ -79,8 +79,7 @@
#endif
// Configure PowerPC emulator
#define PPC_NO_LAZY_PC_UPDATE 1
#define PPC_NO_DECODE_CACHE 1
//#define PPC_FLIGHT_RECORDER 1
#define PPC_FLIGHT_RECORDER 1
#else
// Mac ROM is write protected
#define ROM_IS_WRITE_PROTECTED 1

View File

@ -189,6 +189,10 @@
#undef PPC_LAZY_PC_UPDATE
#endif
#if PPC_FLIGHT_RECORDER
#undef PPC_LAZY_PC_UPDATE
#endif
#if defined(PPC_LAZY_CC_UPDATE) && !defined(PPC_HAVE_SPLIT_CR)
#define PPC_HAVE_SPLIT_CR
#endif

View File

@ -141,6 +141,18 @@ void powerpc_cpu::record_step(uint32 opcode)
#endif
}
void powerpc_cpu::start_log()
{
logging = true;
invalidate_cache();
}
void powerpc_cpu::stop_log()
{
logging = false;
invalidate_cache();
}
void powerpc_cpu::dump_log(const char *filename)
{
if (filename == NULL)
@ -270,6 +282,10 @@ void powerpc_cpu::init_decode_cache()
D(bug("powerpc_cpu: Allocated decode cache: %d KB at %p\n", DECODE_CACHE_SIZE / 1024, decode_cache));
decode_cache_p = decode_cache;
decode_cache_end_p = decode_cache + DECODE_CACHE_MAX_ENTRIES;
#if FLIGHT_RECORDER
// Leave enough room to last call to record_step()
decode_cache_end_p -= 2;
#endif
block_cache.initialize();
#endif

View File

@ -204,8 +204,8 @@ public:
// Handle flight recorder
#if PPC_FLIGHT_RECORDER
bool is_logging() { return logging; }
void start_log() { logging = true; }
void stop_log() { logging = false; }
void start_log();
void stop_log();
void dump_log(const char *filename = NULL);
#else
bool is_logging() { return false; }
@ -342,8 +342,10 @@ inline void powerpc_cpu::do_execute()
#ifdef PPC_EXECUTE_DUMP_STATE
fprintf(stderr, "[%08x]-> %08x\n", pc(), opcode);
#endif
if (logging)
#if FLIGHT_RECORDER
if (is_logging())
record_step(opcode);
#endif
assert(ii->execute != 0);
(this->*(ii->execute))(opcode);
#ifdef PPC_EXECUTE_DUMP_STATE
@ -365,6 +367,13 @@ inline void powerpc_cpu::do_execute()
ii = decode(opcode);
di->opcode = opcode;
di->execute = ii->execute;
#if FLIGHT_RECORDER
if (is_logging()) {
di++;
di->opcode = opcode;
di->execute = record_step;
}
#endif
if (++di >= decode_cache_end_p) {
// Invalidate cache and move current code to start
invalidate_cache();