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;

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

27 *
28 * Authors: Korey Sewell
29 */
30
31#include "arch/mips/faults.hh"
32#include "cpu/thread_context.hh"
33#include "cpu/base.hh"
34#include "base/trace.hh"
35#if !FULL_SYSTEM
36#include "sim/process.hh"
37#include "mem/page_table.hh"
38#endif
39
40namespace MipsISA
41{
42
43FaultName MachineCheckFault::_name = "Machine Check";
44FaultVect MachineCheckFault::_vect = 0x0401;
45FaultStat MachineCheckFault::_count;
46

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

51FaultName ResetFault::_name = "reset";
52FaultVect ResetFault::_vect = 0x0001;
53FaultStat ResetFault::_count;
54
55FaultName ArithmeticFault::_name = "arith";
56FaultVect ArithmeticFault::_vect = 0x0501;
57FaultStat ArithmeticFault::_count;
58
59#if !FULL_SYSTEM
60FaultName PageTableFault::_name = "page_table_fault";
61FaultVect PageTableFault::_vect = 0x0000;
62FaultStat PageTableFault::_count;
63#endif
64
65FaultName InterruptFault::_name = "interrupt";
66FaultVect InterruptFault::_vect = 0x0101;
67FaultStat InterruptFault::_count;
68
69FaultName NDtbMissFault::_name = "dtb_miss_single";
70FaultVect NDtbMissFault::_vect = 0x0201;
71FaultStat NDtbMissFault::_count;
72

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

132}
133
134void ArithmeticFault::invoke(ThreadContext * tc)
135{
136 FaultBase::invoke(tc);
137 panic("Arithmetic traps are unimplemented!");
138}
139
130#endif
140#else //!FULL_SYSTEM
141
142void PageTableFault::invoke(ThreadContext *tc)
143{
144 Process *p = tc->getProcessPtr();
145
146 // address is higher than the stack region or in the current stack region
147 if (vaddr > p->stack_base || vaddr > p->stack_min)
148 FaultBase::invoke(tc);
149
150 // We've accessed the next page
151 if (vaddr > p->stack_min - PageBytes) {
152 p->stack_min -= PageBytes;
153 if (p->stack_base - p->stack_min > 8*1024*1024)
154 fatal("Over max stack size for one thread\n");
155 p->pTable->allocate(p->stack_min, PageBytes);
156 warn("Increasing stack size by one page.");
157 } else {
158 FaultBase::invoke(tc);
159 }
160}
161
162#endif
163} // namespace MipsISA
164