diff options
Diffstat (limited to 'emulate')
| -rw-r--r-- | emulate/cpustate.cpp | 8 | ||||
| -rw-r--r-- | emulate/emulator.cpp | 2 | ||||
| -rw-r--r-- | emulate/emulator.hpp | 10 |
3 files changed, 14 insertions, 6 deletions
diff --git a/emulate/cpustate.cpp b/emulate/cpustate.cpp index 76611b5..19f126a 100644 --- a/emulate/cpustate.cpp +++ b/emulate/cpustate.cpp @@ -23,7 +23,7 @@ std::ostream&operator<<(std::ostream& os, CpuState& cpu) { << PRINT_REGISTER( SS, ss) << PRINT_REGISTER( FS, fs) << PRINT_REGISTER( GS, gs) - << "cf \tpf \taf \tzf \tsf \ttf \tintf \tdf \tof \tnt \trf \tvm \tac \tvif \tvip \tid" << std::endl + << "cf \tpf \taf \tzf \tsf \ttf \tintf \tdf" << std::endl << cpu.cf() << "\t" << cpu.pf() << "\t" << cpu.af() << "\t" @@ -31,7 +31,9 @@ std::ostream&operator<<(std::ostream& os, CpuState& cpu) { << cpu.sf() << "\t" << cpu.tf() << "\t" << cpu.intf() << "\t" - << cpu.df() << "\t" + << cpu.df() + << std::endl << std::endl + << "of \tnt \trf \tvm \tac \tvif \tvip \tid" << std::endl << cpu.of() << "\t" << cpu.nt() << "\t" << cpu.rf() << "\t" @@ -39,7 +41,7 @@ std::ostream&operator<<(std::ostream& os, CpuState& cpu) { << cpu.ac() << "\t" << cpu.vif() << "\t" << cpu.vip() << "\t" - << cpu.id() << "\t" + << cpu.id() << std::endl; return os; } diff --git a/emulate/emulator.cpp b/emulate/emulator.cpp index 805b305..2e30fd8 100644 --- a/emulate/emulator.cpp +++ b/emulate/emulator.cpp @@ -439,6 +439,6 @@ void emulate(std::string file_path) { emulator.cpu.eip() += decinst.size; - emulator.handle_instruction(decinst); + run = emulator.handle_instruction(decinst); } } diff --git a/emulate/emulator.hpp b/emulate/emulator.hpp index fc33722..025c823 100644 --- a/emulate/emulator.hpp +++ b/emulate/emulator.hpp @@ -281,8 +281,14 @@ public: {} }; - void handle_instruction(_DInst inst) { - opcode_handlers.at(inst.opcode)(inst); + bool handle_instruction(_DInst inst) { + try { + opcode_handlers.at(inst.opcode)(inst); + } catch(std::exception const& e) { + std::cerr << "Encountered fatal error: " << e.what() << std::endl; + return false; + } + return true; } }; |
