page_table.cc (2979:88f767122b58) | page_table.cc (3311:7eb47a60dbd4) |
---|---|
1/* 2 * Copyright (c) 2003 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; --- 13 unchanged lines hidden (view full) --- 22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * 28 * Authors: Steve Reinhardt 29 * Ron Dreslinski | 1/* 2 * Copyright (c) 2003 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; --- 13 unchanged lines hidden (view full) --- 22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * 28 * Authors: Steve Reinhardt 29 * Ron Dreslinski |
30 * Ali Saidi |
|
30 */ 31 32/** 33 * @file 34 * Definitions of page table. 35 */ 36#include <string> 37#include <map> --- 54 unchanged lines hidden (view full) --- 92 93 94void 95PageTable::allocate(Addr vaddr, int64_t size) 96{ 97 // starting address must be page aligned 98 assert(pageOffset(vaddr) == 0); 99 | 31 */ 32 33/** 34 * @file 35 * Definitions of page table. 36 */ 37#include <string> 38#include <map> --- 54 unchanged lines hidden (view full) --- 93 94 95void 96PageTable::allocate(Addr vaddr, int64_t size) 97{ 98 // starting address must be page aligned 99 assert(pageOffset(vaddr) == 0); 100 |
101 DPRINTF(MMU, "Allocating Page: %#x-%#x\n", vaddr, vaddr+ size); 102 |
|
100 for (; size > 0; size -= pageSize, vaddr += pageSize) { 101 m5::hash_map<Addr,Addr>::iterator iter = pTable.find(vaddr); 102 103 if (iter != pTable.end()) { 104 // already mapped 105 fatal("PageTable::allocate: address 0x%x already mapped", vaddr); 106 } 107 --- 46 unchanged lines hidden (view full) --- 154 assert(pageAlign(req->getVaddr() + req->getSize() - 1) 155 == pageAlign(req->getVaddr())); 156 if (!translate(req->getVaddr(), paddr)) { 157 return genPageTableFault(req->getVaddr()); 158 } 159 req->setPaddr(paddr); 160 return page_check(req->getPaddr(), req->getSize()); 161} | 103 for (; size > 0; size -= pageSize, vaddr += pageSize) { 104 m5::hash_map<Addr,Addr>::iterator iter = pTable.find(vaddr); 105 106 if (iter != pTable.end()) { 107 // already mapped 108 fatal("PageTable::allocate: address 0x%x already mapped", vaddr); 109 } 110 --- 46 unchanged lines hidden (view full) --- 157 assert(pageAlign(req->getVaddr() + req->getSize() - 1) 158 == pageAlign(req->getVaddr())); 159 if (!translate(req->getVaddr(), paddr)) { 160 return genPageTableFault(req->getVaddr()); 161 } 162 req->setPaddr(paddr); 163 return page_check(req->getPaddr(), req->getSize()); 164} |
165 166void 167PageTable::serialize(std::ostream &os) 168{ 169 paramOut(os, "ptable.size", pTable.size()); 170 int count = 0; 171 172 m5::hash_map<Addr,Addr>::iterator iter; 173 while (iter != pTable.end()) { 174 paramOut(os, csprintf("ptable.entry%dvaddr", count),iter->first); 175 paramOut(os, csprintf("ptable.entry%dpaddr", count),iter->second); 176 ++count; 177 } 178 assert(count == pTable.size()); 179} 180 181void 182PageTable::unserialize(Checkpoint *cp, const std::string §ion) 183{ 184 int i = 0, count; 185 paramIn(cp, section, "ptable.size", count); 186 Addr vaddr, paddr; 187 188 pTable.clear(); 189 190 while(i < count) { 191 paramIn(cp, section, csprintf("ptable.entry%dvaddr", i), vaddr); 192 paramIn(cp, section, csprintf("ptable.entry%dpaddr", i), paddr); 193 pTable[vaddr] = paddr; 194 ++i; 195 } 196 197} 198 |
|