2006-02-22 04:02:05 +01:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2003-2005 The Regents of The University of Michigan
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions are
|
|
|
|
* met: redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer;
|
|
|
|
* redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution;
|
|
|
|
* neither the name of the copyright holders nor the names of its
|
|
|
|
* contributors may be used to endorse or promote products derived from
|
|
|
|
* this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* 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.
|
2006-06-01 01:26:56 +02:00
|
|
|
*
|
|
|
|
* Authors: Korey Sewell
|
2006-02-22 04:02:05 +01:00
|
|
|
*/
|
|
|
|
|
2006-03-08 08:05:38 +01:00
|
|
|
#ifndef __MIPS_FAULTS_HH__
|
|
|
|
#define __MIPS_FAULTS_HH__
|
2006-02-22 04:02:05 +01:00
|
|
|
|
|
|
|
#include "sim/faults.hh"
|
2006-03-12 11:57:34 +01:00
|
|
|
|
|
|
|
// The design of the "name" and "vect" functions is in sim/faults.hh
|
|
|
|
|
|
|
|
namespace MipsISA
|
|
|
|
{
|
|
|
|
|
|
|
|
typedef const Addr FaultVect;
|
2006-02-22 04:02:05 +01:00
|
|
|
|
2006-03-08 08:05:38 +01:00
|
|
|
class MipsFault : public FaultBase
|
2006-02-22 04:02:05 +01:00
|
|
|
{
|
2006-03-12 11:57:34 +01:00
|
|
|
protected:
|
|
|
|
virtual bool skipFaultingInstruction() {return false;}
|
|
|
|
virtual bool setRestartAddress() {return true;}
|
2006-02-22 04:02:05 +01:00
|
|
|
public:
|
2006-03-12 11:57:34 +01:00
|
|
|
#if FULL_SYSTEM
|
2006-06-06 23:32:21 +02:00
|
|
|
void invoke(ThreadContext * tc);
|
2006-03-12 11:57:34 +01:00
|
|
|
#endif
|
|
|
|
virtual FaultVect vect() = 0;
|
|
|
|
virtual FaultStat & countStat() = 0;
|
|
|
|
};
|
2006-02-22 04:02:05 +01:00
|
|
|
|
2006-03-12 11:57:34 +01:00
|
|
|
class MachineCheckFault : public MipsFault
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
static FaultName _name;
|
|
|
|
static FaultVect _vect;
|
|
|
|
static FaultStat _count;
|
|
|
|
public:
|
|
|
|
FaultName name() {return _name;}
|
|
|
|
FaultVect vect() {return _vect;}
|
|
|
|
FaultStat & countStat() {return _count;}
|
|
|
|
bool isMachineCheckFault() {return true;}
|
2006-02-22 04:02:05 +01:00
|
|
|
};
|
|
|
|
|
2006-03-12 11:57:34 +01:00
|
|
|
class AlignmentFault : public MipsFault
|
2006-02-22 04:02:05 +01:00
|
|
|
{
|
2006-03-12 11:57:34 +01:00
|
|
|
private:
|
|
|
|
static FaultName _name;
|
|
|
|
static FaultVect _vect;
|
|
|
|
static FaultStat _count;
|
2006-02-22 04:02:05 +01:00
|
|
|
public:
|
2006-03-12 11:57:34 +01:00
|
|
|
FaultName name() {return _name;}
|
|
|
|
FaultVect vect() {return _vect;}
|
|
|
|
FaultStat & countStat() {return _count;}
|
|
|
|
bool isAlignmentFault() {return true;}
|
|
|
|
};
|
2006-02-22 04:02:05 +01:00
|
|
|
|
2006-03-12 11:57:34 +01:00
|
|
|
static inline Fault genMachineCheckFault()
|
2006-02-22 04:02:05 +01:00
|
|
|
{
|
2006-03-12 11:57:34 +01:00
|
|
|
return new MachineCheckFault;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline Fault genAlignmentFault()
|
|
|
|
{
|
|
|
|
return new AlignmentFault;
|
|
|
|
}
|
|
|
|
|
|
|
|
class ResetFault : public MipsFault
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
static FaultName _name;
|
|
|
|
static FaultVect _vect;
|
|
|
|
static FaultStat _count;
|
2006-02-22 04:02:05 +01:00
|
|
|
public:
|
2006-03-12 11:57:34 +01:00
|
|
|
FaultName name() {return _name;}
|
|
|
|
FaultVect vect() {return _vect;}
|
|
|
|
FaultStat & countStat() {return _count;}
|
|
|
|
};
|
2006-02-22 04:02:05 +01:00
|
|
|
|
2006-03-12 11:57:34 +01:00
|
|
|
class ArithmeticFault : public MipsFault
|
2006-02-22 04:02:05 +01:00
|
|
|
{
|
2006-03-12 11:57:34 +01:00
|
|
|
protected:
|
|
|
|
bool skipFaultingInstruction() {return true;}
|
|
|
|
private:
|
|
|
|
static FaultName _name;
|
|
|
|
static FaultVect _vect;
|
|
|
|
static FaultStat _count;
|
2006-02-22 04:02:05 +01:00
|
|
|
public:
|
2006-03-12 11:57:34 +01:00
|
|
|
FaultName name() {return _name;}
|
|
|
|
FaultVect vect() {return _vect;}
|
|
|
|
FaultStat & countStat() {return _count;}
|
|
|
|
#if FULL_SYSTEM
|
2006-06-06 23:32:21 +02:00
|
|
|
void invoke(ThreadContext * tc);
|
2006-03-12 11:57:34 +01:00
|
|
|
#endif
|
|
|
|
};
|
2006-02-22 04:02:05 +01:00
|
|
|
|
2006-03-12 11:57:34 +01:00
|
|
|
class InterruptFault : public MipsFault
|
2006-02-22 04:02:05 +01:00
|
|
|
{
|
2006-03-12 11:57:34 +01:00
|
|
|
protected:
|
|
|
|
bool setRestartAddress() {return false;}
|
|
|
|
private:
|
|
|
|
static FaultName _name;
|
|
|
|
static FaultVect _vect;
|
|
|
|
static FaultStat _count;
|
2006-02-22 04:02:05 +01:00
|
|
|
public:
|
2006-03-12 11:57:34 +01:00
|
|
|
FaultName name() {return _name;}
|
|
|
|
FaultVect vect() {return _vect;}
|
|
|
|
FaultStat & countStat() {return _count;}
|
|
|
|
};
|
2006-02-22 04:02:05 +01:00
|
|
|
|
2006-03-12 11:57:34 +01:00
|
|
|
class NDtbMissFault : public MipsFault
|
2006-02-22 04:02:05 +01:00
|
|
|
{
|
2006-03-12 11:57:34 +01:00
|
|
|
private:
|
|
|
|
static FaultName _name;
|
|
|
|
static FaultVect _vect;
|
|
|
|
static FaultStat _count;
|
2006-02-22 04:02:05 +01:00
|
|
|
public:
|
2006-03-12 11:57:34 +01:00
|
|
|
FaultName name() {return _name;}
|
|
|
|
FaultVect vect() {return _vect;}
|
|
|
|
FaultStat & countStat() {return _count;}
|
|
|
|
};
|
2006-02-22 04:02:05 +01:00
|
|
|
|
2006-03-12 11:57:34 +01:00
|
|
|
class PDtbMissFault : public MipsFault
|
2006-02-22 04:02:05 +01:00
|
|
|
{
|
2006-03-12 11:57:34 +01:00
|
|
|
private:
|
|
|
|
static FaultName _name;
|
|
|
|
static FaultVect _vect;
|
|
|
|
static FaultStat _count;
|
2006-02-22 04:02:05 +01:00
|
|
|
public:
|
2006-03-12 11:57:34 +01:00
|
|
|
FaultName name() {return _name;}
|
|
|
|
FaultVect vect() {return _vect;}
|
|
|
|
FaultStat & countStat() {return _count;}
|
|
|
|
};
|
2006-02-22 04:02:05 +01:00
|
|
|
|
2006-03-12 11:57:34 +01:00
|
|
|
class DtbPageFault : public MipsFault
|
2006-02-22 04:02:05 +01:00
|
|
|
{
|
2006-03-12 11:57:34 +01:00
|
|
|
private:
|
|
|
|
static FaultName _name;
|
|
|
|
static FaultVect _vect;
|
|
|
|
static FaultStat _count;
|
2006-02-22 04:02:05 +01:00
|
|
|
public:
|
2006-03-12 11:57:34 +01:00
|
|
|
FaultName name() {return _name;}
|
|
|
|
FaultVect vect() {return _vect;}
|
|
|
|
FaultStat & countStat() {return _count;}
|
|
|
|
};
|
|
|
|
|
|
|
|
class DtbAcvFault : public MipsFault
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
static FaultName _name;
|
|
|
|
static FaultVect _vect;
|
|
|
|
static FaultStat _count;
|
|
|
|
public:
|
|
|
|
FaultName name() {return _name;}
|
|
|
|
FaultVect vect() {return _vect;}
|
|
|
|
FaultStat & countStat() {return _count;}
|
|
|
|
};
|
2006-02-22 04:02:05 +01:00
|
|
|
|
2006-03-12 11:57:34 +01:00
|
|
|
class ItbMissFault : public MipsFault
|
2006-02-22 04:02:05 +01:00
|
|
|
{
|
2006-03-12 11:57:34 +01:00
|
|
|
private:
|
|
|
|
static FaultName _name;
|
|
|
|
static FaultVect _vect;
|
|
|
|
static FaultStat _count;
|
2006-02-22 04:02:05 +01:00
|
|
|
public:
|
2006-03-12 11:57:34 +01:00
|
|
|
FaultName name() {return _name;}
|
|
|
|
FaultVect vect() {return _vect;}
|
|
|
|
FaultStat & countStat() {return _count;}
|
|
|
|
};
|
2006-02-22 04:02:05 +01:00
|
|
|
|
2006-03-12 11:57:34 +01:00
|
|
|
class ItbPageFault : public MipsFault
|
2006-02-22 04:02:05 +01:00
|
|
|
{
|
2006-03-12 11:57:34 +01:00
|
|
|
private:
|
|
|
|
static FaultName _name;
|
|
|
|
static FaultVect _vect;
|
|
|
|
static FaultStat _count;
|
2006-02-22 04:02:05 +01:00
|
|
|
public:
|
2006-03-12 11:57:34 +01:00
|
|
|
FaultName name() {return _name;}
|
|
|
|
FaultVect vect() {return _vect;}
|
|
|
|
FaultStat & countStat() {return _count;}
|
|
|
|
};
|
2006-02-22 04:02:05 +01:00
|
|
|
|
2006-03-12 11:57:34 +01:00
|
|
|
class ItbAcvFault : public MipsFault
|
2006-02-22 04:02:05 +01:00
|
|
|
{
|
2006-03-12 11:57:34 +01:00
|
|
|
private:
|
|
|
|
static FaultName _name;
|
|
|
|
static FaultVect _vect;
|
|
|
|
static FaultStat _count;
|
2006-02-22 04:02:05 +01:00
|
|
|
public:
|
2006-03-12 11:57:34 +01:00
|
|
|
FaultName name() {return _name;}
|
|
|
|
FaultVect vect() {return _vect;}
|
|
|
|
FaultStat & countStat() {return _count;}
|
|
|
|
};
|
2006-02-22 04:02:05 +01:00
|
|
|
|
2006-03-12 11:57:34 +01:00
|
|
|
class UnimplementedOpcodeFault : public MipsFault
|
2006-02-22 04:02:05 +01:00
|
|
|
{
|
2006-03-12 11:57:34 +01:00
|
|
|
private:
|
|
|
|
static FaultName _name;
|
|
|
|
static FaultVect _vect;
|
|
|
|
static FaultStat _count;
|
2006-02-22 04:02:05 +01:00
|
|
|
public:
|
2006-03-12 11:57:34 +01:00
|
|
|
FaultName name() {return _name;}
|
|
|
|
FaultVect vect() {return _vect;}
|
|
|
|
FaultStat & countStat() {return _count;}
|
|
|
|
};
|
2006-02-22 04:02:05 +01:00
|
|
|
|
2006-03-12 11:57:34 +01:00
|
|
|
class FloatEnableFault : public MipsFault
|
2006-02-22 04:02:05 +01:00
|
|
|
{
|
2006-03-12 11:57:34 +01:00
|
|
|
private:
|
|
|
|
static FaultName _name;
|
|
|
|
static FaultVect _vect;
|
|
|
|
static FaultStat _count;
|
2006-02-22 04:02:05 +01:00
|
|
|
public:
|
2006-03-12 11:57:34 +01:00
|
|
|
FaultName name() {return _name;}
|
|
|
|
FaultVect vect() {return _vect;}
|
|
|
|
FaultStat & countStat() {return _count;}
|
|
|
|
};
|
2006-02-22 04:02:05 +01:00
|
|
|
|
2006-03-12 11:57:34 +01:00
|
|
|
class PalFault : public MipsFault
|
2006-02-22 04:02:05 +01:00
|
|
|
{
|
2006-03-12 11:57:34 +01:00
|
|
|
protected:
|
|
|
|
bool skipFaultingInstruction() {return true;}
|
|
|
|
private:
|
|
|
|
static FaultName _name;
|
|
|
|
static FaultVect _vect;
|
|
|
|
static FaultStat _count;
|
2006-02-22 04:02:05 +01:00
|
|
|
public:
|
2006-03-12 11:57:34 +01:00
|
|
|
FaultName name() {return _name;}
|
|
|
|
FaultVect vect() {return _vect;}
|
|
|
|
FaultStat & countStat() {return _count;}
|
|
|
|
};
|
2006-02-22 04:02:05 +01:00
|
|
|
|
2006-03-12 11:57:34 +01:00
|
|
|
class IntegerOverflowFault : public MipsFault
|
2006-02-22 04:02:05 +01:00
|
|
|
{
|
2006-03-12 11:57:34 +01:00
|
|
|
private:
|
|
|
|
static FaultName _name;
|
|
|
|
static FaultVect _vect;
|
|
|
|
static FaultStat _count;
|
2006-02-22 04:02:05 +01:00
|
|
|
public:
|
2006-03-12 11:57:34 +01:00
|
|
|
FaultName name() {return _name;}
|
|
|
|
FaultVect vect() {return _vect;}
|
|
|
|
FaultStat & countStat() {return _count;}
|
|
|
|
};
|
2006-02-22 04:02:05 +01:00
|
|
|
|
2006-03-12 11:57:34 +01:00
|
|
|
} // MipsISA namespace
|
2006-02-22 04:02:05 +01:00
|
|
|
|
|
|
|
#endif // __FAULTS_HH__
|