tlb.cc (4957:f858d0b8ef99) tlb.cc (4962:4e939f4629c3)
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;

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

75
76// look up an entry in the TLB
77PTE *
78TLB::lookup(Addr vpn, uint8_t asn) const
79{
80 // assume not found...
81 PTE *retval = NULL;
82
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;

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

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

--- 522 unchanged lines hidden ---
109 break;
110 }
111
112 ++i;
113 }
114 }
115 }
116

--- 522 unchanged lines hidden ---