faults.hh (2665:a124942bacb8) faults.hh (2680:246e7104f744)
1/*
2 * Copyright (c) 2003-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 22 unchanged lines hidden (view full) ---

31
32#ifndef __FAULTS_HH__
33#define __FAULTS_HH__
34
35#include "base/refcnt.hh"
36#include "sim/stats.hh"
37#include "config/full_system.hh"
38
1/*
2 * Copyright (c) 2003-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 22 unchanged lines hidden (view full) ---

31
32#ifndef __FAULTS_HH__
33#define __FAULTS_HH__
34
35#include "base/refcnt.hh"
36#include "sim/stats.hh"
37#include "config/full_system.hh"
38
39class ExecContext;
39class ThreadContext;
40class FaultBase;
41typedef RefCountingPtr<FaultBase> Fault;
42
43typedef const char * FaultName;
44typedef Stats::Scalar<> FaultStat;
45
46// Each class has it's name statically define in _name,
47// and has a virtual function to access it's name.
48// The function is necessary because otherwise, all objects
49// which are being accessed cast as a FaultBase * (namely
50// all faults returned using the Fault type) will use the
51// generic FaultBase name.
52
53class FaultBase : public RefCounted
54{
55 public:
56 virtual FaultName name() = 0;
57#if FULL_SYSTEM
40class FaultBase;
41typedef RefCountingPtr<FaultBase> Fault;
42
43typedef const char * FaultName;
44typedef Stats::Scalar<> FaultStat;
45
46// Each class has it's name statically define in _name,
47// and has a virtual function to access it's name.
48// The function is necessary because otherwise, all objects
49// which are being accessed cast as a FaultBase * (namely
50// all faults returned using the Fault type) will use the
51// generic FaultBase name.
52
53class FaultBase : public RefCounted
54{
55 public:
56 virtual FaultName name() = 0;
57#if FULL_SYSTEM
58 virtual void invoke(ExecContext * xc);
58 virtual void invoke(ThreadContext * tc);
59#else
59#else
60 virtual void invoke(ExecContext * xc);
60 virtual void invoke(ThreadContext * tc);
61#endif
62// template<typename T>
63// bool isA() {return dynamic_cast<T *>(this);}
64 virtual bool isMachineCheckFault() {return false;}
65 virtual bool isAlignmentFault() {return false;}
66};
67
68FaultBase * const NoFault = 0;
69
70class UnimpFault : public FaultBase
71{
72 private:
73 std::string panicStr;
74 public:
75 UnimpFault(std::string _str)
76 : panicStr(_str)
77 { }
78
79 FaultName name() {return "Unimplemented simulator feature";}
61#endif
62// template<typename T>
63// bool isA() {return dynamic_cast<T *>(this);}
64 virtual bool isMachineCheckFault() {return false;}
65 virtual bool isAlignmentFault() {return false;}
66};
67
68FaultBase * const NoFault = 0;
69
70class UnimpFault : public FaultBase
71{
72 private:
73 std::string panicStr;
74 public:
75 UnimpFault(std::string _str)
76 : panicStr(_str)
77 { }
78
79 FaultName name() {return "Unimplemented simulator feature";}
80 void invoke(ExecContext * xc);
80 void invoke(ThreadContext * tc);
81};
82
83#endif // __FAULTS_HH__
81};
82
83#endif // __FAULTS_HH__