faults.cc (4172:141705d83494) | faults.cc (4183:3d19c1d46946) |
---|---|
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; --- 253 unchanged lines hidden (view full) --- 262template<> SparcFaultBase::FaultVals 263 SparcFault<FillNOther>::vals = 264 {"fill_n_other", 0x0E0, 900, {P, P, H}}; 265 266template<> SparcFaultBase::FaultVals 267 SparcFault<TrapInstruction>::vals = 268 {"trap_instruction", 0x100, 1602, {P, P, H}}; 269 | 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; --- 253 unchanged lines hidden (view full) --- 262template<> SparcFaultBase::FaultVals 263 SparcFault<FillNOther>::vals = 264 {"fill_n_other", 0x0E0, 900, {P, P, H}}; 265 266template<> SparcFaultBase::FaultVals 267 SparcFault<TrapInstruction>::vals = 268 {"trap_instruction", 0x100, 1602, {P, P, H}}; 269 |
270#if !FULL_SYSTEM 271template<> SparcFaultBase::FaultVals 272 SparcFault<PageTableFault>::vals = 273 {"page_table_fault", 0x0000, 0, {SH, SH, SH}}; 274#endif 275 | |
276/** 277 * This causes the thread context to enter RED state. This causes the side 278 * effects which go with entering RED state because of a trap. 279 */ 280 281void enterREDState(ThreadContext *tc) 282{ 283 //@todo Disable the mmu? --- 391 unchanged lines hidden (view full) --- 675 676 //We need to explicitly advance the pc, since that's not done for us 677 //on a faulting instruction 678 tc->setPC(tc->readNextPC()); 679 tc->setNextPC(tc->readNextNPC()); 680 tc->setNextNPC(tc->readNextNPC() + sizeof(MachInst)); 681} 682 | 270/** 271 * This causes the thread context to enter RED state. This causes the side 272 * effects which go with entering RED state because of a trap. 273 */ 274 275void enterREDState(ThreadContext *tc) 276{ 277 //@todo Disable the mmu? --- 391 unchanged lines hidden (view full) --- 669 670 //We need to explicitly advance the pc, since that's not done for us 671 //on a faulting instruction 672 tc->setPC(tc->readNextPC()); 673 tc->setNextPC(tc->readNextNPC()); 674 tc->setNextNPC(tc->readNextNPC() + sizeof(MachInst)); 675} 676 |
683void PageTableFault::invoke(ThreadContext *tc) 684{ 685 Process *p = tc->getProcessPtr(); 686 687 // We've accessed the next page of the stack, so extend the stack 688 // to cover it. 689 if(vaddr < p->stack_min && vaddr >= p->stack_min - PageBytes) 690 { 691 p->stack_min -= PageBytes; 692 if(p->stack_base - p->stack_min > 8*1024*1024) 693 fatal("Over max stack size for one thread\n"); 694 p->pTable->allocate(p->stack_min, PageBytes); 695 warn("Increasing stack size by one page."); 696 } 697 // Otherwise, we have an unexpected page fault. Report that fact, 698 // and what address was accessed to cause the fault. 699 else 700 { 701 panic("Page table fault when accessing virtual address %#x\n", vaddr); 702 } 703} 704 | |
705#endif 706 707} // namespace SparcISA 708 | 677#endif 678 679} // namespace SparcISA 680 |