faults.hh (4183:3d19c1d46946) faults.hh (4695:a63378aed062)
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;

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

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:
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;

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

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;
56 virtual FaultName name() const = 0;
57 virtual void invoke(ThreadContext * tc);
58// template<typename T>
59// bool isA() {return dynamic_cast<T *>(this);}
57 virtual void invoke(ThreadContext * tc);
58// template<typename T>
59// bool isA() {return dynamic_cast<T *>(this);}
60 virtual bool isMachineCheckFault() {return false;}
61 virtual bool isAlignmentFault() {return false;}
60 virtual bool isMachineCheckFault() const {return false;}
61 virtual bool isAlignmentFault() const {return false;}
62};
63
64FaultBase * const NoFault = 0;
65
66class UnimpFault : public FaultBase
67{
68 private:
69 std::string panicStr;
70 public:
71 UnimpFault(std::string _str)
72 : panicStr(_str)
73 { }
74
62};
63
64FaultBase * const NoFault = 0;
65
66class UnimpFault : public FaultBase
67{
68 private:
69 std::string panicStr;
70 public:
71 UnimpFault(std::string _str)
72 : panicStr(_str)
73 { }
74
75 FaultName name() {return "Unimplemented simulator feature";}
75 FaultName name() const {return "Unimplemented simulator feature";}
76 void invoke(ThreadContext * tc);
77};
78
79#if !FULL_SYSTEM
80class PageTableFault : public FaultBase
81{
82 private:
83 Addr vaddr;
84 public:
76 void invoke(ThreadContext * tc);
77};
78
79#if !FULL_SYSTEM
80class PageTableFault : public FaultBase
81{
82 private:
83 Addr vaddr;
84 public:
85 FaultName name() {return "M5 page table fault";}
85 FaultName name() const {return "M5 page table fault";}
86 PageTableFault(Addr va) : vaddr(va) {}
87 void invoke(ThreadContext * tc);
88};
89#endif
90
91#endif // __FAULTS_HH__
86 PageTableFault(Addr va) : vaddr(va) {}
87 void invoke(ThreadContext * tc);
88};
89#endif
90
91#endif // __FAULTS_HH__