2 * Copyright (c) 2003-2005 The Regents of The University of Michigan
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;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 #include "arch/alpha/faults.hh"
30 #include "cpu/exec_context.hh"
31 #include "cpu/base.hh"
32 #include "base/trace.hh"
37 FaultName
MachineCheckFault::_name
= "mchk";
38 FaultVect
MachineCheckFault::_vect
= 0x0401;
39 FaultStat
MachineCheckFault::_count
;
41 FaultName
AlignmentFault::_name
= "unalign";
42 FaultVect
AlignmentFault::_vect
= 0x0301;
43 FaultStat
AlignmentFault::_count
;
45 FaultName
ResetFault::_name
= "reset";
46 FaultVect
ResetFault::_vect
= 0x0001;
47 FaultStat
ResetFault::_count
;
49 FaultName
ArithmeticFault::_name
= "arith";
50 FaultVect
ArithmeticFault::_vect
= 0x0501;
51 FaultStat
ArithmeticFault::_count
;
53 FaultName
InterruptFault::_name
= "interrupt";
54 FaultVect
InterruptFault::_vect
= 0x0101;
55 FaultStat
InterruptFault::_count
;
57 FaultName
NDtbMissFault::_name
= "dtb_miss_single";
58 FaultVect
NDtbMissFault::_vect
= 0x0201;
59 FaultStat
NDtbMissFault::_count
;
61 FaultName
PDtbMissFault::_name
= "dtb_miss_double";
62 FaultVect
PDtbMissFault::_vect
= 0x0281;
63 FaultStat
PDtbMissFault::_count
;
65 FaultName
DtbPageFault::_name
= "dfault";
66 FaultVect
DtbPageFault::_vect
= 0x0381;
67 FaultStat
DtbPageFault::_count
;
69 FaultName
DtbAcvFault::_name
= "dfault";
70 FaultVect
DtbAcvFault::_vect
= 0x0381;
71 FaultStat
DtbAcvFault::_count
;
73 FaultName
ItbMissFault::_name
= "itbmiss";
74 FaultVect
ItbMissFault::_vect
= 0x0181;
75 FaultStat
ItbMissFault::_count
;
77 FaultName
ItbPageFault::_name
= "itbmiss";
78 FaultVect
ItbPageFault::_vect
= 0x0181;
79 FaultStat
ItbPageFault::_count
;
81 FaultName
ItbAcvFault::_name
= "iaccvio";
82 FaultVect
ItbAcvFault::_vect
= 0x0081;
83 FaultStat
ItbAcvFault::_count
;
85 FaultName
UnimplementedOpcodeFault::_name
= "opdec";
86 FaultVect
UnimplementedOpcodeFault::_vect
= 0x0481;
87 FaultStat
UnimplementedOpcodeFault::_count
;
89 FaultName
FloatEnableFault::_name
= "fen";
90 FaultVect
FloatEnableFault::_vect
= 0x0581;
91 FaultStat
FloatEnableFault::_count
;
93 FaultName
PalFault::_name
= "pal";
94 FaultVect
PalFault::_vect
= 0x2001;
95 FaultStat
PalFault::_count
;
97 FaultName
IntegerOverflowFault::_name
= "intover";
98 FaultVect
IntegerOverflowFault::_vect
= 0x0501;
99 FaultStat
IntegerOverflowFault::_count
;
103 void AlphaFault::invoke(ExecContext
* xc
)
105 FaultBase::invoke(xc
);
108 // exception restart address
109 if (setRestartAddress() || !xc
->inPalMode())
110 xc
->setMiscReg(AlphaISA::IPR_EXC_ADDR
, xc
->regs
.pc
);
112 if (skipFaultingInstruction()) {
113 // traps... skip faulting instruction.
114 xc
->setMiscReg(AlphaISA::IPR_EXC_ADDR
,
115 xc
->readMiscReg(AlphaISA::IPR_EXC_ADDR
) + 4);
118 if (!xc
->inPalMode())
119 AlphaISA::swap_palshadow(&(xc
->regs
), true);
121 xc
->regs
.pc
= xc
->readMiscReg(AlphaISA::IPR_PAL_BASE
) + vect();
122 xc
->regs
.npc
= xc
->regs
.pc
+ sizeof(MachInst
);
125 void ArithmeticFault::invoke(ExecContext
* xc
)
127 FaultBase::invoke(xc
);
128 panic("Arithmetic traps are unimplemented!");
133 } // namespace AlphaISA