Commit ccb4add9 authored by Benoit Perrot's avatar Benoit Perrot
Browse files

2006-01-08 Benoît Perrot <benoit@lrde.epita.fr>

	Do not call exit_set inside control coprocessor

	* src/vm/cp0.hh, src/vm/cp0.hxx:
	(get_register) New.
	(raise_overflow, raise_addr_load, raise_addr_store): Activate
	fatal_exception_, remove call to exit_set.
	* src/vm/virtual_machine.cc:
	(execute) Use exit_set to report internal exception.
parent 313aa026
2006-01-08 Benot Perrot <benoit@lrde.epita.fr>
Do not call exit_set inside control coprocessor
* src/vm/cp0.hh, src/vm/cp0.hxx:
(get_register) New.
(raise_overflow, raise_addr_load, raise_addr_store): Activate
fatal_exception_, remove call to exit_set.
* src/vm/virtual_machine.cc:
(execute) Use exit_set to report internal exception.
2006-01-08 Benot Perrot <benoit@lrde.epita.fr>
Remove dirty access to libparse internal
......
......@@ -116,6 +116,8 @@ namespace vm
void set_register(const inst::Register &reg, register_type r);
/// Return the register identified by \a reg.
register_type get_register(const inst::Register &reg) const;
register_type get_register(kind_type k) const;
/** \} */
......
......@@ -69,6 +69,11 @@ namespace vm
precondition(reg.get_kind() == inst::Register::generic);
return registers[reg.get_index()];
}
inline Cp0::register_type
Cp0::get_register(kind_type k) const
{
return registers[k];
}
//
inline void
......@@ -76,7 +81,7 @@ namespace vm
{
registers[cause] = overflow;
std::cerr << "Runtime Exception: Overflow" << std::endl;
exit_set(exit_runtime);
fatal_exception_ = true;
}
inline void
......@@ -85,7 +90,6 @@ namespace vm
registers[cause] = addr_load;
std::cerr << "Runtime Exception: Address error on load" << std::endl;
fatal_exception_ = true;
exit_set(exit_runtime);
}
inline void
Cp0::raise_addr_store()
......@@ -93,7 +97,6 @@ namespace vm
registers[cause] = addr_store;
std::cerr << "Runtime Exception: Address error on store" << std::endl;
fatal_exception_ = true;
exit_set(exit_runtime);
}
//
......
......@@ -66,6 +66,10 @@ namespace vm
cpu_.step();
cp0_.set_count(cp0_.get_count() + 1);
}
// FIXME: this is not the good test, but for the moment it suffices
if (cp0_.get_register(Cp0::cause) != Cp0::interrupt)
exit_set(exit_runtime);
}
void
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment