* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Authors: Nathan Binkert
+ * Gabe Black
*/
+#include "arch/isa_traits.hh"
#include "base/misc.hh"
-#include "sim/faults.hh"
-#include "cpu/exec_context.hh"
#include "cpu/base.hh"
+#include "cpu/thread_context.hh"
+#include "debug/Fault.hh"
+#include "mem/page_table.hh"
+#include "sim/faults.hh"
+#include "sim/full_system.hh"
+#include "sim/process.hh"
+
+void FaultBase::invoke(ThreadContext * tc, const StaticInstPtr &inst)
+{
+ if (FullSystem) {
+ DPRINTF(Fault, "Fault %s at PC: %s\n", name(), tc->pcState());
+ } else {
+ panic("fault (%s) detected @ PC %s", name(), tc->pcState());
+ }
+}
-#if !FULL_SYSTEM
-void FaultBase::invoke(ExecContext * xc)
+void UnimpFault::invoke(ThreadContext * tc, const StaticInstPtr &inst)
{
- fatal("fault (%s) detected @ PC 0x%08p", name(), xc->readPC());
+ panic("Unimpfault: %s\n", panicStr.c_str());
+}
+
+void ReExec::invoke(ThreadContext *tc, const StaticInstPtr &inst)
+{
+ tc->pcState(tc->pcState());
}
-#else
-void FaultBase::invoke(ExecContext * xc)
+
+void GenericPageTableFault::invoke(ThreadContext *tc, const StaticInstPtr &inst)
{
- DPRINTF(Fault, "Fault %s at PC: %#x\n", name(), xc->readPC());
- xc->getCpuPtr()->recordEvent(csprintf("Fault %s", name()));
+ bool handled = false;
+ if (!FullSystem) {
+ Process *p = tc->getProcessPtr();
+ handled = p->fixupStackFault(vaddr);
+ }
+ if (!handled)
+ panic("Page table fault when accessing virtual address %#x\n", vaddr);
- assert(!xc->misspeculating());
}
-#endif
-void UnimpFault::invoke(ExecContext * xc)
+void GenericAlignmentFault::invoke(ThreadContext *tc, const StaticInstPtr &inst)
{
- panic("Unimpfault: %s\n", panicStr.c_str());
+ panic("Alignment fault when accessing virtual address %#x\n", vaddr);
}