Deleted Added
sdiff udiff text old ( 8696:642f83fafffb ) new ( 8767:e575781f71b8 )
full compact
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 */
33
34#include <string>
35#include <vector>
36
37#include "arch/mips/faults.hh"
38#include "arch/mips/pagetable.hh"
39#include "arch/mips/pra_constants.hh"

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

124 assert(Index<size);
125 return &table[Index];
126}
127
128int
129TLB::probeEntry(Addr vpn, uint8_t asn) const
130{
131 // assume not found...
132 PTE *retval = NULL;
133 int Ind = -1;
134 PageTable::const_iterator i = lookupTable.find(vpn);
135 if (i != lookupTable.end()) {
136 while (i->first == vpn) {
137 int index = i->second;
138 PTE *pte = &table[index];
139
140 /* 1KB TLB Lookup code - from MIPS ARM Volume III - Rev. 2.50 */
141 Addr Mask = pte->Mask;
142 Addr InvMask = ~Mask;
143 Addr VPN = pte->VPN;
144 if (((vpn & InvMask) == (VPN & InvMask)) &&
145 (pte->G || (asn == pte->asid))) {
146 // We have a VPN + ASID Match
147 retval = pte;
148 Ind = index;
149 break;
150 }
151 ++i;
152 }
153 }
154 DPRINTF(MipsPRA,"VPN: %x, asid: %d, Result of TLBP: %d\n",vpn,asn,Ind);
155 return Ind;

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

290 hits = read_hits + write_hits;
291 misses = read_misses + write_misses;
292 accesses = read_accesses + write_accesses;
293}
294
295Fault
296TLB::translateInst(RequestPtr req, ThreadContext *tc)
297{
298 if (!FullSystem) {
299 Process * p = tc->getProcessPtr();
300
301 Fault fault = p->pTable->translate(req);
302 if (fault != NoFault)
303 return fault;
304
305 return NoFault;
306 } else {
307 panic("translateInst not implemented in MIPS.\n");
308 }
309}
310
311Fault
312TLB::translateData(RequestPtr req, ThreadContext *tc, bool write)
313{
314 if (!FullSystem) {
315 //@TODO: This should actually use TLB instead of going directly
316 // to the page table in syscall mode.
317 /**
318 * Check for alignment faults
319 */
320 if (req->getVaddr() & (req->getSize() - 1)) {
321 DPRINTF(TLB, "Alignment Fault on %#x, size = %d", req->getVaddr(),
322 req->getSize());
323 return new AddressErrorFault(req->getVaddr(), write);
324 }
325
326
327 Process * p = tc->getProcessPtr();
328
329 Fault fault = p->pTable->translate(req);
330 if (fault != NoFault)
331 return fault;
332
333 return NoFault;
334 } else {
335 panic("translateData not implemented in MIPS.\n");
336 }
337}
338
339Fault
340TLB::translateAtomic(RequestPtr req, ThreadContext *tc, Mode mode)
341{
342 if (mode == Execute)
343 return translateInst(req, tc);
344 else

--- 28 unchanged lines hidden ---