tlb.cc (4962:4e939f4629c3) tlb.cc (4967:fb9a1d205359)
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 *
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) const
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
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)
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)) {
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 = pte;
106 PTECache[2] = PTECache[1];
107 PTECache[1] = PTECache[0];
108 PTECache[0] = pte;
105 retval = updateCache(pte);
109 break;
110 }
111
112 ++i;
113 }
114 }
115 }
116

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

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

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

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

--- 150 unchanged lines hidden ---
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 ---