1/* 2 * Copyright (c) 2001-2005 The Regents of The University of Michigan 3 * Copyright (c) 2007 MIPS Technologies, Inc. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions are 8 * met: redistributions of source code must retain the above copyright --- 15 unchanged lines hidden (view full) --- 24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * 29 * Authors: Nathan Binkert 30 * Steve Reinhardt 31 * Jaidev Patwardhan |
32 * Zhengxing Li 33 * Deyuan Guo |
34 */ 35 36#include <string> 37#include <vector> 38 39#include "arch/mips/faults.hh" 40#include "arch/mips/pagetable.hh" 41#include "arch/mips/pra_constants.hh" --- 305 unchanged lines hidden (view full) --- 347 EvenOdd = 0; 348 } else { 349 // Check odd bits 350 Valid = pte->V1; 351 EvenOdd = 1; 352 } 353 354 if (Valid == false) { |
355 return new TlbInvalidFault(Asid, vaddr, VPN, false); |
356 } else { 357 // Ok, this is really a match, set paddr 358 Addr PAddr; 359 if (EvenOdd == 0) { 360 PAddr = pte->PFN0; 361 } else { 362 PAddr = pte->PFN1; 363 } 364 PAddr >>= (pte->AddrShiftAmount - 12); 365 PAddr <<= pte->AddrShiftAmount; 366 PAddr |= (vaddr & pte->OffsetMask); 367 req->setPaddr(PAddr); 368 } 369 } else { 370 // Didn't find any match, return a TLB Refill Exception |
371 return new TlbRefillFault(Asid, vaddr, VPN, false); |
372 } 373 } 374 return checkCacheability(req); 375#endif 376} 377 378Fault 379TLB::translateData(RequestPtr req, ThreadContext *tc, bool write) --- 62 unchanged lines hidden (view full) --- 442 } else { 443 // Check odd bits 444 Valid = pte->V1; 445 Dirty = pte->D1; 446 EvenOdd = 1; 447 } 448 449 if (Valid == false) { |
450 return new TlbInvalidFault(Asid, vaddr, VPN, write); |
451 } else { 452 // Ok, this is really a match, set paddr |
453 if (!Dirty && write) { |
454 return new TlbModifiedFault(Asid, vaddr, VPN); 455 } 456 Addr PAddr; 457 if (EvenOdd == 0) { 458 PAddr = pte->PFN0; 459 } else { 460 PAddr = pte->PFN1; 461 } 462 PAddr >>= (pte->AddrShiftAmount - 12); 463 PAddr <<= pte->AddrShiftAmount; 464 PAddr |= (vaddr & pte->OffsetMask); 465 req->setPaddr(PAddr); 466 } 467 } else { 468 // Didn't find any match, return a TLB Refill Exception |
469 return new TlbRefillFault(Asid, vaddr, VPN, write); |
470 } 471 } 472 return checkCacheability(req); 473#endif 474} 475 476Fault 477TLB::translateAtomic(RequestPtr req, ThreadContext *tc, Mode mode) --- 32 unchanged lines hidden --- |