Index: ChangeLog
from Benoît Perrot <benoit(a)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 Benoît Perrot <benoit(a)lrde.epita.fr>
Index: src/vm/cp0.hh
--- src/vm/cp0.hh (revision 210)
+++ src/vm/cp0.hh (working copy)
@@ -116,6 +116,8 @@
void set_register(const inst::Register ®, register_type r);
/// Return the register identified by \a reg.
register_type get_register(const inst::Register ®) const;
+
+ register_type get_register(kind_type k) const;
/** \} */
Index: src/vm/cp0.hxx
--- src/vm/cp0.hxx (revision 210)
+++ src/vm/cp0.hxx (working copy)
@@ -69,6 +69,11 @@
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 @@
{
registers[cause] = overflow;
std::cerr << "Runtime Exception: Overflow" << std::endl;
- exit_set(exit_runtime);
+ fatal_exception_ = true;
}
inline void
@@ -85,7 +90,6 @@
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 @@
registers[cause] = addr_store;
std::cerr << "Runtime Exception: Address error on store" <<
std::endl;
fatal_exception_ = true;
- exit_set(exit_runtime);
}
//
Index: src/vm/virtual_machine.cc
--- src/vm/virtual_machine.cc (revision 210)
+++ src/vm/virtual_machine.cc (working copy)
@@ -66,6 +66,10 @@
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