tlb.cc (7612:917946898102) tlb.cc (7694:de057cccee82)
1/*
2 * Copyright (c) 2010 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

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

79}
80
81TLB::~TLB()
82{
83 if (table)
84 delete [] table;
85}
86
1/*
2 * Copyright (c) 2010 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

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

79}
80
81TLB::~TLB()
82{
83 if (table)
84 delete [] table;
85}
86
87bool
88TLB::translateFunctional(ThreadContext *tc, Addr va, Addr &pa)
89{
90 uint32_t context_id = tc->readMiscReg(MISCREG_CONTEXTIDR);
91 TlbEntry *e = lookup(va, context_id, true);
92 if (!e)
93 return false;
94 pa = e->pAddr(va);
95 return true;
96}
97
87TlbEntry*
98TlbEntry*
88TLB::lookup(Addr va, uint8_t cid)
99TLB::lookup(Addr va, uint8_t cid, bool functional)
89{
90 // XXX This should either turn into a TlbMap or add caching
91
92 TlbEntry *retval = NULL;
93
94 // Do some kind of caching, fast indexing, anything
95
96 int x = 0;
97 while (retval == NULL && x < size) {
98 if (table[x].match(va, cid)) {
99 retval = &table[x];
100{
101 // XXX This should either turn into a TlbMap or add caching
102
103 TlbEntry *retval = NULL;
104
105 // Do some kind of caching, fast indexing, anything
106
107 int x = 0;
108 while (retval == NULL && x < size) {
109 if (table[x].match(va, cid)) {
110 retval = &table[x];
100 if (x == nlu)
111 if (x == nlu && !functional)
101 nextnlu();
102
103 break;
104 }
105 x++;
106 }
107
108 DPRINTF(TLBVerbose, "Lookup %#x, cid %#x -> %s ppn %#x size: %#x pa: %#x ap:%d\n",

--- 474 unchanged lines hidden ---
112 nextnlu();
113
114 break;
115 }
116 x++;
117 }
118
119 DPRINTF(TLBVerbose, "Lookup %#x, cid %#x -> %s ppn %#x size: %#x pa: %#x ap:%d\n",

--- 474 unchanged lines hidden ---