Deleted Added
sdiff udiff text old ( 4962:4e939f4629c3 ) new ( 4967:fb9a1d205359 )
full compact
1/*
2 * Copyright (c) 2001-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;

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

70TLB::~TLB()
71{
72 if (table)
73 delete [] table;
74}
75
76// look up an entry in the TLB
77PTE *
78TLB::lookup(Addr vpn, uint8_t asn)
79{
80 // assume not found...
81 PTE *retval = NULL;
82
83 if (PTECache[0]) {
84 if (vpn == PTECache[0]->tag &&
85 (PTECache[0]->asma || PTECache[0]->asn == asn))
86 retval = PTECache[0];
87 else if (PTECache[1]) {
88 if (vpn == PTECache[1]->tag &&
89 (PTECache[1]->asma || PTECache[1]->asn == asn))
90 retval = PTECache[1];
91 else if (PTECache[2] && vpn == PTECache[2]->tag &&
92 (PTECache[2]->asma || PTECache[2]->asn == asn))
93 retval = PTECache[2];
94 }
95 }
96
97 if (retval == NULL) {
98 PageTable::const_iterator i = lookupTable.find(vpn);
99 if (i != lookupTable.end()) {
100 while (i->first == vpn) {
101 int index = i->second;
102 PTE *pte = &table[index];
103 assert(pte->valid);
104 if (vpn == pte->tag && (pte->asma || pte->asn == asn)) {
105 retval = updateCache(pte);
106 break;
107 }
108
109 ++i;
110 }
111 }
112 }
113

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

307 .name(name() + ".accesses")
308 .desc("ITB accesses");
309
310 accesses = hits + misses;
311}
312
313
314Fault
315ITB::translate(RequestPtr &req, ThreadContext *tc)
316{
317 //If this is a pal pc, then set PHYSICAL
318 if(FULL_SYSTEM && PcPAL(req->getPC()))
319 req->setFlags(req->getFlags() | PHYSICAL);
320
321 if (PcPAL(req->getPC())) {
322 // strip off PAL PC marker (lsb is 1)
323 req->setPaddr((req->getVaddr() & ~3) & PAddrImplMask);

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

469
470 hits = read_hits + write_hits;
471 misses = read_misses + write_misses;
472 acv = read_acv + write_acv;
473 accesses = read_accesses + write_accesses;
474}
475
476Fault
477DTB::translate(RequestPtr &req, ThreadContext *tc, bool write)
478{
479 Addr pc = tc->readPC();
480
481 mode_type mode =
482 (mode_type)DTB_CM_CM(tc->readMiscRegNoEffect(IPR_DTB_CM));
483
484
485 /**

--- 150 unchanged lines hidden ---