faults.cc revision 4997
12131SN/A/*
22131SN/A * Copyright (c) 2003-2005 The Regents of The University of Michigan
32131SN/A * All rights reserved.
42131SN/A *
52131SN/A * Redistribution and use in source and binary forms, with or without
62131SN/A * modification, are permitted provided that the following conditions are
72131SN/A * met: redistributions of source code must retain the above copyright
82131SN/A * notice, this list of conditions and the following disclaimer;
92131SN/A * redistributions in binary form must reproduce the above copyright
102131SN/A * notice, this list of conditions and the following disclaimer in the
112131SN/A * documentation and/or other materials provided with the distribution;
122131SN/A * neither the name of the copyright holders nor the names of its
132131SN/A * contributors may be used to endorse or promote products derived from
142131SN/A * this software without specific prior written permission.
152131SN/A *
162131SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
172131SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
182131SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
192131SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
202131SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
212131SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
222131SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
232131SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
242131SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
252131SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
262131SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272665Ssaidi@eecs.umich.edu *
282935Sksewell@umich.edu * Authors: Gabe Black
292935Sksewell@umich.edu *          Korey Sewell
302131SN/A */
312131SN/A
322239SN/A#include "arch/mips/faults.hh"
332680Sktlim@umich.edu#include "cpu/thread_context.hh"
342447SN/A#include "cpu/base.hh"
352447SN/A#include "base/trace.hh"
362935Sksewell@umich.edu
372800Ssaidi@eecs.umich.edu#if !FULL_SYSTEM
382800Ssaidi@eecs.umich.edu#include "sim/process.hh"
392800Ssaidi@eecs.umich.edu#include "mem/page_table.hh"
402800Ssaidi@eecs.umich.edu#endif
412131SN/A
422447SN/Anamespace MipsISA
432447SN/A{
442131SN/A
452479SN/AFaultName MachineCheckFault::_name = "Machine Check";
462447SN/AFaultVect MachineCheckFault::_vect = 0x0401;
472447SN/AFaultStat MachineCheckFault::_count;
482131SN/A
492479SN/AFaultName AlignmentFault::_name = "Alignment";
502447SN/AFaultVect AlignmentFault::_vect = 0x0301;
512447SN/AFaultStat AlignmentFault::_count;
522447SN/A
532447SN/AFaultName ResetFault::_name = "reset";
542447SN/AFaultVect ResetFault::_vect = 0x0001;
552447SN/AFaultStat ResetFault::_count;
562447SN/A
574661Sksewell@umich.eduFaultName CoprocessorUnusableFault::_name = "Coprocessor Unusable";
584661Sksewell@umich.eduFaultVect CoprocessorUnusableFault::_vect = 0xF001;
594661Sksewell@umich.eduFaultStat CoprocessorUnusableFault::_count;
604661Sksewell@umich.edu
614661Sksewell@umich.eduFaultName ReservedInstructionFault::_name = "Reserved Instruction";
624661Sksewell@umich.eduFaultVect ReservedInstructionFault::_vect = 0x0F01;
634661Sksewell@umich.eduFaultStat ReservedInstructionFault::_count;
644661Sksewell@umich.edu
654661Sksewell@umich.eduFaultName ThreadFault::_name = "thread";
664661Sksewell@umich.eduFaultVect ThreadFault::_vect = 0x00F1;
674661Sksewell@umich.eduFaultStat ThreadFault::_count;
684661Sksewell@umich.edu
694661Sksewell@umich.edu
702447SN/AFaultName ArithmeticFault::_name = "arith";
712447SN/AFaultVect ArithmeticFault::_vect = 0x0501;
722447SN/AFaultStat ArithmeticFault::_count;
732447SN/A
744661Sksewell@umich.eduFaultName UnimplementedOpcodeFault::_name = "opdec";
754661Sksewell@umich.eduFaultVect UnimplementedOpcodeFault::_vect = 0x0481;
764661Sksewell@umich.eduFaultStat UnimplementedOpcodeFault::_count;
774661Sksewell@umich.edu
784661Sksewell@umich.edu#if !FULL_SYSTEM
794661Sksewell@umich.edu//FaultName PageTableFault::_name = "page_table_fault";
804661Sksewell@umich.edu//FaultVect PageTableFault::_vect = 0x0000;
814661Sksewell@umich.edu//FaultStat PageTableFault::_count;
824661Sksewell@umich.edu#endif
834661Sksewell@umich.edu
842447SN/AFaultName InterruptFault::_name = "interrupt";
852447SN/AFaultVect InterruptFault::_vect = 0x0101;
862447SN/AFaultStat InterruptFault::_count;
872447SN/A
882447SN/AFaultName NDtbMissFault::_name = "dtb_miss_single";
892447SN/AFaultVect NDtbMissFault::_vect = 0x0201;
902447SN/AFaultStat NDtbMissFault::_count;
912447SN/A
922447SN/AFaultName PDtbMissFault::_name = "dtb_miss_double";
932447SN/AFaultVect PDtbMissFault::_vect = 0x0281;
942447SN/AFaultStat PDtbMissFault::_count;
952447SN/A
962447SN/AFaultName DtbPageFault::_name = "dfault";
972447SN/AFaultVect DtbPageFault::_vect = 0x0381;
982447SN/AFaultStat DtbPageFault::_count;
992447SN/A
1002447SN/AFaultName DtbAcvFault::_name = "dfault";
1012447SN/AFaultVect DtbAcvFault::_vect = 0x0381;
1022447SN/AFaultStat DtbAcvFault::_count;
1032447SN/A
1042447SN/AFaultName ItbMissFault::_name = "itbmiss";
1052447SN/AFaultVect ItbMissFault::_vect = 0x0181;
1062447SN/AFaultStat ItbMissFault::_count;
1072447SN/A
1082447SN/AFaultName ItbPageFault::_name = "itbmiss";
1092447SN/AFaultVect ItbPageFault::_vect = 0x0181;
1102447SN/AFaultStat ItbPageFault::_count;
1112447SN/A
1122447SN/AFaultName ItbAcvFault::_name = "iaccvio";
1132447SN/AFaultVect ItbAcvFault::_vect = 0x0081;
1142447SN/AFaultStat ItbAcvFault::_count;
1152447SN/A
1162447SN/AFaultName FloatEnableFault::_name = "fen";
1172447SN/AFaultVect FloatEnableFault::_vect = 0x0581;
1182447SN/AFaultStat FloatEnableFault::_count;
1192447SN/A
1202447SN/AFaultName IntegerOverflowFault::_name = "intover";
1212447SN/AFaultVect IntegerOverflowFault::_vect = 0x0501;
1222447SN/AFaultStat IntegerOverflowFault::_count;
1232447SN/A
1244661Sksewell@umich.eduFaultName DspStateDisabledFault::_name = "intover";
1254661Sksewell@umich.eduFaultVect DspStateDisabledFault::_vect = 0x001a;
1264661Sksewell@umich.eduFaultStat DspStateDisabledFault::_count;
1274661Sksewell@umich.edu
1284661Sksewell@umich.edu
1294661Sksewell@umich.edu/*void PageTableFault::invoke(ThreadContext *tc)
1304661Sksewell@umich.edu{
1314661Sksewell@umich.edu    Process *p = tc->getProcessPtr();
1324661Sksewell@umich.edu
1334661Sksewell@umich.edu    Addr page_addr = p->pTable->pageAlign(vaddr);
1344661Sksewell@umich.edu
1354661Sksewell@umich.edu    warn("%i: [tid:%i]: %s encountered @ addr %x. Allocating new page for address range %x - %x.\n",
1364661Sksewell@umich.edu         curTick, tc->getThreadNum(), name(), vaddr, page_addr, page_addr+VMPageSize);
1374661Sksewell@umich.edu
1384661Sksewell@umich.edu    p->pTable->allocate(page_addr, VMPageSize);
1394661Sksewell@umich.edu
1404661Sksewell@umich.edu    return;
1414661Sksewell@umich.edu}
1424661Sksewell@umich.edu*/
1434661Sksewell@umich.edu    /* address is higher than the stack region or in the current stack region
1444661Sksewell@umich.edu    if (vaddr > p->stack_base || vaddr > p->stack_min)
1454661Sksewell@umich.edu        FaultBase::invoke(tc);
1464661Sksewell@umich.edu
1474661Sksewell@umich.edu    // We've accessed the next page
1484661Sksewell@umich.edu    if (vaddr > p->stack_min - PageBytes) {
1494661Sksewell@umich.edu        p->stack_min -= PageBytes;
1504661Sksewell@umich.edu        if (p->stack_base - p->stack_min > 8*1024*1024) {
1514661Sksewell@umich.edu            warn("Already allocated Over max stack size for one thread\n");
1524661Sksewell@umich.edu        }
1534661Sksewell@umich.edu        warn("%i: Allocating page for range %x - %x",
1544661Sksewell@umich.edu             curTick, p->stack_min, p->stack_min-PageBytes);
1554661Sksewell@umich.edu
1564661Sksewell@umich.edu        p->pTable->allocate(p->stack_min, PageBytes);
1574661Sksewell@umich.edu        warn("Increasing stack size by one page.");
1584661Sksewell@umich.edu    } else {
1594661Sksewell@umich.edu        FaultBase::invoke(tc);
1604661Sksewell@umich.edu        }*/
1614661Sksewell@umich.edu
1624661Sksewell@umich.eduvoid ResetFault::invoke(ThreadContext *tc)
1634661Sksewell@umich.edu{
1644661Sksewell@umich.edu    warn("[tid:%i]: %s encountered.\n", tc->getThreadNum(), name());
1654661Sksewell@umich.edu    //tc->getCpuPtr()->reset();
1664661Sksewell@umich.edu}
1674661Sksewell@umich.edu
1684661Sksewell@umich.eduvoid CoprocessorUnusableFault::invoke(ThreadContext *tc)
1694661Sksewell@umich.edu{
1704661Sksewell@umich.edu    panic("[tid:%i]: %s encountered.\n", tc->getThreadNum(), name());
1714661Sksewell@umich.edu}
1724661Sksewell@umich.edu
1734661Sksewell@umich.eduvoid ReservedInstructionFault::invoke(ThreadContext *tc)
1744661Sksewell@umich.edu{
1754661Sksewell@umich.edu    panic("[tid:%i]: %s encountered.\n", tc->getThreadNum(), name());
1764661Sksewell@umich.edu}
1774661Sksewell@umich.edu
1784661Sksewell@umich.eduvoid ThreadFault::invoke(ThreadContext *tc)
1794661Sksewell@umich.edu{
1804661Sksewell@umich.edu    panic("[tid:%i]: %s encountered.\n", tc->getThreadNum(), name());
1814661Sksewell@umich.edu}
1824661Sksewell@umich.edu
1834661Sksewell@umich.eduvoid DspStateDisabledFault::invoke(ThreadContext *tc)
1844661Sksewell@umich.edu{
1854661Sksewell@umich.edu    panic("[tid:%i]: %s encountered.\n", tc->getThreadNum(), name());
1864661Sksewell@umich.edu}
1874661Sksewell@umich.edu
1882447SN/A} // namespace MipsISA
1892447SN/A
190