tlb.cc (8568:83f728db3332) | tlb.cc (8570:ea93f18eead8) |
---|---|
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 --- 299 unchanged lines hidden (view full) --- 308 309 bool misaligned = (req->getSize() - 1) & vaddr; 310 311 if (IsKSeg0(vaddr)) { 312 // Address will not be translated through TLB, set response, and go! 313 req->setPaddr(KSeg02Phys(vaddr)); 314 if (getOperatingMode(tc->readMiscReg(MISCREG_STATUS)) != mode_kernel || 315 misaligned) { | 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 --- 299 unchanged lines hidden (view full) --- 308 309 bool misaligned = (req->getSize() - 1) & vaddr; 310 311 if (IsKSeg0(vaddr)) { 312 // Address will not be translated through TLB, set response, and go! 313 req->setPaddr(KSeg02Phys(vaddr)); 314 if (getOperatingMode(tc->readMiscReg(MISCREG_STATUS)) != mode_kernel || 315 misaligned) { |
316 return new AddressErrorFault(vaddr); | 316 return new AddressErrorFault(vaddr, false); |
317 } 318 } else if(IsKSeg1(vaddr)) { 319 // Address will not be translated through TLB, set response, and go! 320 req->setPaddr(KSeg02Phys(vaddr)); 321 } else { 322 /* 323 * This is an optimization - smallPages is updated every time a TLB 324 * operation is performed. That way, we don't need to look at 325 * Config3 _ SP and PageGrain _ ESP every time we do a TLB lookup 326 */ 327 Addr VPN; 328 if (smallPages == 1) { 329 VPN = (vaddr >> 11); 330 } else { 331 VPN = ((vaddr >> 11) & 0xFFFFFFFC); 332 } 333 uint8_t Asid = req->getAsid(); 334 if (misaligned) { 335 // Unaligned address! | 317 } 318 } else if(IsKSeg1(vaddr)) { 319 // Address will not be translated through TLB, set response, and go! 320 req->setPaddr(KSeg02Phys(vaddr)); 321 } else { 322 /* 323 * This is an optimization - smallPages is updated every time a TLB 324 * operation is performed. That way, we don't need to look at 325 * Config3 _ SP and PageGrain _ ESP every time we do a TLB lookup 326 */ 327 Addr VPN; 328 if (smallPages == 1) { 329 VPN = (vaddr >> 11); 330 } else { 331 VPN = ((vaddr >> 11) & 0xFFFFFFFC); 332 } 333 uint8_t Asid = req->getAsid(); 334 if (misaligned) { 335 // Unaligned address! |
336 return new AddressErrorFault(vaddr); | 336 return new AddressErrorFault(vaddr, false); |
337 } 338 PTE *pte = lookup(VPN,Asid); 339 if (pte != NULL) { 340 // Ok, found something 341 /* Check for valid bits */ 342 int EvenOdd; 343 bool Valid; 344 if ((((vaddr) >> pte->AddrShiftAmount) & 1) == 0) { --- 37 unchanged lines hidden (view full) --- 382 //@TODO: This should actually use TLB instead of going directly 383 // to the page table in syscall mode. 384 /** 385 * Check for alignment faults 386 */ 387 if (req->getVaddr() & (req->getSize() - 1)) { 388 DPRINTF(TLB, "Alignment Fault on %#x, size = %d", req->getVaddr(), 389 req->getSize()); | 337 } 338 PTE *pte = lookup(VPN,Asid); 339 if (pte != NULL) { 340 // Ok, found something 341 /* Check for valid bits */ 342 int EvenOdd; 343 bool Valid; 344 if ((((vaddr) >> pte->AddrShiftAmount) & 1) == 0) { --- 37 unchanged lines hidden (view full) --- 382 //@TODO: This should actually use TLB instead of going directly 383 // to the page table in syscall mode. 384 /** 385 * Check for alignment faults 386 */ 387 if (req->getVaddr() & (req->getSize() - 1)) { 388 DPRINTF(TLB, "Alignment Fault on %#x, size = %d", req->getVaddr(), 389 req->getSize()); |
390 if (write) 391 return new StoreAddressErrorFault(req->getVaddr()); 392 else 393 return new AddressErrorFault(req->getVaddr()); | 390 return new AddressErrorFault(req->getVaddr(), write); |
394 } 395 396 397 Process * p = tc->getProcessPtr(); 398 399 Fault fault = p->pTable->translate(req); 400 if (fault != NoFault) 401 return fault; --- 4 unchanged lines hidden (view full) --- 406 407 bool misaligned = (req->getSize() - 1) & vaddr; 408 409 if (IsKSeg0(vaddr)) { 410 // Address will not be translated through TLB, set response, and go! 411 req->setPaddr(KSeg02Phys(vaddr)); 412 if (getOperatingMode(tc->readMiscReg(MISCREG_STATUS)) != mode_kernel || 413 misaligned) { | 391 } 392 393 394 Process * p = tc->getProcessPtr(); 395 396 Fault fault = p->pTable->translate(req); 397 if (fault != NoFault) 398 return fault; --- 4 unchanged lines hidden (view full) --- 403 404 bool misaligned = (req->getSize() - 1) & vaddr; 405 406 if (IsKSeg0(vaddr)) { 407 // Address will not be translated through TLB, set response, and go! 408 req->setPaddr(KSeg02Phys(vaddr)); 409 if (getOperatingMode(tc->readMiscReg(MISCREG_STATUS)) != mode_kernel || 410 misaligned) { |
414 return new StoreAddressErrorFault(vaddr); | 411 return new AddressErrorFault(vaddr, true); |
415 } 416 } else if(IsKSeg1(vaddr)) { 417 // Address will not be translated through TLB, set response, and go! 418 req->setPaddr(KSeg02Phys(vaddr)); 419 } else { 420 /* 421 * This is an optimization - smallPages is updated every time a TLB 422 * operation is performed. That way, we don't need to look at 423 * Config3 _ SP and PageGrain _ ESP every time we do a TLB lookup 424 */ 425 Addr VPN = (vaddr >> 11) & 0xFFFFFFFC; 426 if (smallPages == 1) { 427 VPN = vaddr >> 11; 428 } 429 uint8_t Asid = req->getAsid(); 430 PTE *pte = lookup(VPN, Asid); 431 if (misaligned) { | 412 } 413 } else if(IsKSeg1(vaddr)) { 414 // Address will not be translated through TLB, set response, and go! 415 req->setPaddr(KSeg02Phys(vaddr)); 416 } else { 417 /* 418 * This is an optimization - smallPages is updated every time a TLB 419 * operation is performed. That way, we don't need to look at 420 * Config3 _ SP and PageGrain _ ESP every time we do a TLB lookup 421 */ 422 Addr VPN = (vaddr >> 11) & 0xFFFFFFFC; 423 if (smallPages == 1) { 424 VPN = vaddr >> 11; 425 } 426 uint8_t Asid = req->getAsid(); 427 PTE *pte = lookup(VPN, Asid); 428 if (misaligned) { |
432 return new StoreAddressErrorFault(vaddr); | 429 return new AddressErrorFault(vaddr, true); |
433 } 434 if (pte != NULL) { 435 // Ok, found something 436 /* Check for valid bits */ 437 int EvenOdd; 438 bool Valid; 439 bool Dirty; 440 if ((((vaddr >> pte->AddrShiftAmount) & 1)) == 0) { --- 72 unchanged lines hidden --- | 430 } 431 if (pte != NULL) { 432 // Ok, found something 433 /* Check for valid bits */ 434 int EvenOdd; 435 bool Valid; 436 bool Dirty; 437 if ((((vaddr >> pte->AddrShiftAmount) & 1)) == 0) { --- 72 unchanged lines hidden --- |