faults.cc (3761:b7c7f547d5a3) | faults.cc (3786:6e5d10d0ed38) |
---|---|
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; --- 676 unchanged lines hidden (view full) --- 685 tc->setNextPC(fillStart + sizeof(MachInst)); 686 tc->setNextNPC(fillStart + 2*sizeof(MachInst)); 687} 688 689void PageTableFault::invoke(ThreadContext *tc) 690{ 691 Process *p = tc->getProcessPtr(); 692 | 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; --- 676 unchanged lines hidden (view full) --- 685 tc->setNextPC(fillStart + sizeof(MachInst)); 686 tc->setNextNPC(fillStart + 2*sizeof(MachInst)); 687} 688 689void PageTableFault::invoke(ThreadContext *tc) 690{ 691 Process *p = tc->getProcessPtr(); 692 |
693 // address is higher than the stack region or in the current stack region 694 if (vaddr > p->stack_base || vaddr > p->stack_min) 695 FaultBase::invoke(tc); 696 697 // We've accessed the next page 698 if (vaddr > p->stack_min - PageBytes) { | 693 // We've accessed the next page of the stack, so extend the stack 694 // to cover it. 695 if(vaddr < p->stack_min && vaddr >= p->stack_min - PageBytes) 696 { |
699 p->stack_min -= PageBytes; | 697 p->stack_min -= PageBytes; |
700 if (p->stack_base - p->stack_min > 8*1024*1024) | 698 if(p->stack_base - p->stack_min > 8*1024*1024) |
701 fatal("Over max stack size for one thread\n"); 702 p->pTable->allocate(p->stack_min, PageBytes); 703 warn("Increasing stack size by one page."); | 699 fatal("Over max stack size for one thread\n"); 700 p->pTable->allocate(p->stack_min, PageBytes); 701 warn("Increasing stack size by one page."); |
704 } else { 705 FaultBase::invoke(tc); | |
706 } | 702 } |
703 // Otherwise, we have an unexpected page fault. Report that fact, 704 // and what address was accessed to cause the fault. 705 else 706 { 707 panic("Page table fault when accessing virtual address %#x\n", vaddr); 708 } |
|
707} 708 709#endif 710 711} // namespace SparcISA 712 | 709} 710 711#endif 712 713} // namespace SparcISA 714 |