faults.hh revision 6735
16019Shines@cs.fsu.edu/*
26019Shines@cs.fsu.edu * Copyright (c) 2003-2005 The Regents of The University of Michigan
36019Shines@cs.fsu.edu * Copyright (c) 2007-2008 The Florida State University
46019Shines@cs.fsu.edu * All rights reserved.
56019Shines@cs.fsu.edu *
66019Shines@cs.fsu.edu * Redistribution and use in source and binary forms, with or without
76019Shines@cs.fsu.edu * modification, are permitted provided that the following conditions are
86019Shines@cs.fsu.edu * met: redistributions of source code must retain the above copyright
96019Shines@cs.fsu.edu * notice, this list of conditions and the following disclaimer;
106019Shines@cs.fsu.edu * redistributions in binary form must reproduce the above copyright
116019Shines@cs.fsu.edu * notice, this list of conditions and the following disclaimer in the
126019Shines@cs.fsu.edu * documentation and/or other materials provided with the distribution;
136019Shines@cs.fsu.edu * neither the name of the copyright holders nor the names of its
146019Shines@cs.fsu.edu * contributors may be used to endorse or promote products derived from
156019Shines@cs.fsu.edu * this software without specific prior written permission.
166019Shines@cs.fsu.edu *
176019Shines@cs.fsu.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
186019Shines@cs.fsu.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
196019Shines@cs.fsu.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
206019Shines@cs.fsu.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
216019Shines@cs.fsu.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
226019Shines@cs.fsu.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
236019Shines@cs.fsu.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
246019Shines@cs.fsu.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
256019Shines@cs.fsu.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
266019Shines@cs.fsu.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
276019Shines@cs.fsu.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
286019Shines@cs.fsu.edu *
296735Sgblack@eecs.umich.edu * Authors: Ali Saidi
306735Sgblack@eecs.umich.edu *          Gabe Black
316019Shines@cs.fsu.edu */
326019Shines@cs.fsu.edu
336019Shines@cs.fsu.edu#ifndef __ARM_FAULTS_HH__
346019Shines@cs.fsu.edu#define __ARM_FAULTS_HH__
356019Shines@cs.fsu.edu
366735Sgblack@eecs.umich.edu#include "arch/arm/types.hh"
376735Sgblack@eecs.umich.edu#include "config/full_system.hh"
386019Shines@cs.fsu.edu#include "sim/faults.hh"
396019Shines@cs.fsu.edu
406019Shines@cs.fsu.edu// The design of the "name" and "vect" functions is in sim/faults.hh
416019Shines@cs.fsu.edu
426019Shines@cs.fsu.edunamespace ArmISA
436019Shines@cs.fsu.edu{
446735Sgblack@eecs.umich.edutypedef const Addr FaultOffset;
456019Shines@cs.fsu.edu
466735Sgblack@eecs.umich.educlass ArmFaultBase : public FaultBase
476019Shines@cs.fsu.edu{
486019Shines@cs.fsu.edu  protected:
496735Sgblack@eecs.umich.edu    Addr getVector(ThreadContext *tc);
506735Sgblack@eecs.umich.edu
516019Shines@cs.fsu.edu  public:
526735Sgblack@eecs.umich.edu    struct FaultVals
536735Sgblack@eecs.umich.edu    {
546735Sgblack@eecs.umich.edu        const FaultName name;
556735Sgblack@eecs.umich.edu        const FaultOffset offset;
566735Sgblack@eecs.umich.edu        const OperatingMode nextMode;
576735Sgblack@eecs.umich.edu        const uint8_t armPcOffset;
586735Sgblack@eecs.umich.edu        const uint8_t thumbPcOffset;
596735Sgblack@eecs.umich.edu        const bool abortDisable;
606735Sgblack@eecs.umich.edu        const bool fiqDisable;
616735Sgblack@eecs.umich.edu        FaultStat count;
626735Sgblack@eecs.umich.edu    };
636735Sgblack@eecs.umich.edu
646019Shines@cs.fsu.edu#if FULL_SYSTEM
656735Sgblack@eecs.umich.edu    void invoke(ThreadContext *tc);
666019Shines@cs.fsu.edu#endif
676735Sgblack@eecs.umich.edu    virtual FaultStat& countStat() = 0;
686735Sgblack@eecs.umich.edu    virtual FaultOffset offset() = 0;
696735Sgblack@eecs.umich.edu    virtual OperatingMode nextMode() = 0;
706735Sgblack@eecs.umich.edu    virtual uint8_t armPcOffset() = 0;
716735Sgblack@eecs.umich.edu    virtual uint8_t thumbPcOffset() = 0;
726735Sgblack@eecs.umich.edu    virtual bool abortDisable() = 0;
736735Sgblack@eecs.umich.edu    virtual bool fiqDisable() = 0;
746019Shines@cs.fsu.edu};
756019Shines@cs.fsu.edu
766735Sgblack@eecs.umich.edutemplate<typename T>
776735Sgblack@eecs.umich.educlass ArmFault : public ArmFaultBase
786019Shines@cs.fsu.edu{
796735Sgblack@eecs.umich.edu  protected:
806735Sgblack@eecs.umich.edu    static FaultVals vals;
816735Sgblack@eecs.umich.edu
826019Shines@cs.fsu.edu  public:
836735Sgblack@eecs.umich.edu    FaultName name() const { return vals.name; }
846735Sgblack@eecs.umich.edu    FaultStat & countStat() {return vals.count;}
856735Sgblack@eecs.umich.edu    FaultOffset offset() { return vals.offset; }
866735Sgblack@eecs.umich.edu    OperatingMode nextMode() { return vals.nextMode; }
876735Sgblack@eecs.umich.edu    uint8_t armPcOffset() { return vals.armPcOffset; }
886735Sgblack@eecs.umich.edu    uint8_t thumbPcOffset() { return vals.thumbPcOffset; }
896735Sgblack@eecs.umich.edu    bool abortDisable() { return vals.abortDisable; }
906735Sgblack@eecs.umich.edu    bool fiqDisable() { return vals.fiqDisable; }
916019Shines@cs.fsu.edu};
926019Shines@cs.fsu.edu
936019Shines@cs.fsu.edu
946735Sgblack@eecs.umich.educlass Reset                : public ArmFault<Reset> {};
956735Sgblack@eecs.umich.educlass UndefinedInstruction : public ArmFault<UndefinedInstruction> {};
966735Sgblack@eecs.umich.educlass SupervisorCall       : public ArmFault<SupervisorCall> {};
976735Sgblack@eecs.umich.educlass PrefetchAbort        : public ArmFault<PrefetchAbort> {};
986735Sgblack@eecs.umich.educlass DataAbort            : public ArmFault<DataAbort> {};
996735Sgblack@eecs.umich.educlass Interrupt            : public ArmFault<Interrupt> {};
1006735Sgblack@eecs.umich.educlass FastInterrupt        : public ArmFault<FastInterrupt> {};
1016019Shines@cs.fsu.edu
1026019Shines@cs.fsu.edu
1036019Shines@cs.fsu.edu} // ArmISA namespace
1046019Shines@cs.fsu.edu
1056019Shines@cs.fsu.edu#endif // __ARM_FAULTS_HH__
106