tlb.cc (10824:308771bd2647) | tlb.cc (10905:a6ca6831e775) |
---|---|
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; --- 1339 unchanged lines hidden (view full) --- 1348 if (ps == Ps1 && split) 1349 ptr |= ULL(1) << (13 + tsb_size); 1350 ptr |= (tag_access >> (9 + page_size * 3)) & mask(12+tsb_size, 4); 1351 1352 return ptr; 1353} 1354 1355void | 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; --- 1339 unchanged lines hidden (view full) --- 1348 if (ps == Ps1 && split) 1349 ptr |= ULL(1) << (13 + tsb_size); 1350 ptr |= (tag_access >> (9 + page_size * 3)) & mask(12+tsb_size, 4); 1351 1352 return ptr; 1353} 1354 1355void |
1356TLB::serialize(std::ostream &os) | 1356TLB::serialize(CheckpointOut &cp) const |
1357{ 1358 SERIALIZE_SCALAR(size); 1359 SERIALIZE_SCALAR(usedEntries); 1360 SERIALIZE_SCALAR(lastReplaced); 1361 1362 // convert the pointer based free list into an index based one | 1357{ 1358 SERIALIZE_SCALAR(size); 1359 SERIALIZE_SCALAR(usedEntries); 1360 SERIALIZE_SCALAR(lastReplaced); 1361 1362 // convert the pointer based free list into an index based one |
1363 int *free_list = (int*)malloc(sizeof(int) * size); 1364 int cntr = 0; 1365 std::list<TlbEntry*>::iterator i; 1366 i = freeList.begin(); 1367 while (i != freeList.end()) { 1368 free_list[cntr++] = ((size_t)*i - (size_t)tlb)/ sizeof(TlbEntry); 1369 i++; 1370 } 1371 SERIALIZE_SCALAR(cntr); 1372 SERIALIZE_ARRAY(free_list, cntr); | 1363 std::vector<int> free_list; 1364 for (const TlbEntry *entry : freeList) 1365 free_list.push_back(entry - tlb); |
1373 | 1366 |
1367 SERIALIZE_CONTAINER(free_list); 1368 |
|
1374 SERIALIZE_SCALAR(c0_tsb_ps0); 1375 SERIALIZE_SCALAR(c0_tsb_ps1); 1376 SERIALIZE_SCALAR(c0_config); 1377 SERIALIZE_SCALAR(cx_tsb_ps0); 1378 SERIALIZE_SCALAR(cx_tsb_ps1); 1379 SERIALIZE_SCALAR(cx_config); 1380 SERIALIZE_SCALAR(sfsr); 1381 SERIALIZE_SCALAR(tag_access); 1382 1383 for (int x = 0; x < size; x++) { | 1369 SERIALIZE_SCALAR(c0_tsb_ps0); 1370 SERIALIZE_SCALAR(c0_tsb_ps1); 1371 SERIALIZE_SCALAR(c0_config); 1372 SERIALIZE_SCALAR(cx_tsb_ps0); 1373 SERIALIZE_SCALAR(cx_tsb_ps1); 1374 SERIALIZE_SCALAR(cx_config); 1375 SERIALIZE_SCALAR(sfsr); 1376 SERIALIZE_SCALAR(tag_access); 1377 1378 for (int x = 0; x < size; x++) { |
1384 nameOut(os, csprintf("%s.PTE%d", name(), x)); 1385 tlb[x].serialize(os); | 1379 ScopedCheckpointSection sec(cp, csprintf("PTE%d", x)); 1380 tlb[x].serialize(cp); |
1386 } 1387 SERIALIZE_SCALAR(sfar); 1388} 1389 1390void | 1381 } 1382 SERIALIZE_SCALAR(sfar); 1383} 1384 1385void |
1391TLB::unserialize(Checkpoint *cp, const std::string §ion) | 1386TLB::unserialize(CheckpointIn &cp) |
1392{ 1393 int oldSize; 1394 | 1387{ 1388 int oldSize; 1389 |
1395 paramIn(cp, section, "size", oldSize); | 1390 paramIn(cp, "size", oldSize); |
1396 if (oldSize != size) 1397 panic("Don't support unserializing different sized TLBs\n"); 1398 UNSERIALIZE_SCALAR(usedEntries); 1399 UNSERIALIZE_SCALAR(lastReplaced); 1400 | 1391 if (oldSize != size) 1392 panic("Don't support unserializing different sized TLBs\n"); 1393 UNSERIALIZE_SCALAR(usedEntries); 1394 UNSERIALIZE_SCALAR(lastReplaced); 1395 |
1401 int cntr; 1402 UNSERIALIZE_SCALAR(cntr); 1403 1404 int *free_list = (int*)malloc(sizeof(int) * cntr); | 1396 std::vector<int> free_list; 1397 UNSERIALIZE_CONTAINER(free_list); |
1405 freeList.clear(); | 1398 freeList.clear(); |
1406 UNSERIALIZE_ARRAY(free_list, cntr); 1407 for (int x = 0; x < cntr; x++) 1408 freeList.push_back(&tlb[free_list[x]]); | 1399 for (int idx : free_list) 1400 freeList.push_back(&tlb[idx]); |
1409 1410 UNSERIALIZE_SCALAR(c0_tsb_ps0); 1411 UNSERIALIZE_SCALAR(c0_tsb_ps1); 1412 UNSERIALIZE_SCALAR(c0_config); 1413 UNSERIALIZE_SCALAR(cx_tsb_ps0); 1414 UNSERIALIZE_SCALAR(cx_tsb_ps1); 1415 UNSERIALIZE_SCALAR(cx_config); 1416 UNSERIALIZE_SCALAR(sfsr); 1417 UNSERIALIZE_SCALAR(tag_access); 1418 1419 lookupTable.clear(); 1420 for (int x = 0; x < size; x++) { | 1401 1402 UNSERIALIZE_SCALAR(c0_tsb_ps0); 1403 UNSERIALIZE_SCALAR(c0_tsb_ps1); 1404 UNSERIALIZE_SCALAR(c0_config); 1405 UNSERIALIZE_SCALAR(cx_tsb_ps0); 1406 UNSERIALIZE_SCALAR(cx_tsb_ps1); 1407 UNSERIALIZE_SCALAR(cx_config); 1408 UNSERIALIZE_SCALAR(sfsr); 1409 UNSERIALIZE_SCALAR(tag_access); 1410 1411 lookupTable.clear(); 1412 for (int x = 0; x < size; x++) { |
1421 tlb[x].unserialize(cp, csprintf("%s.PTE%d", section, x)); | 1413 ScopedCheckpointSection sec(cp, csprintf("PTE%d", x)); 1414 tlb[x].unserialize(cp); |
1422 if (tlb[x].valid) 1423 lookupTable.insert(tlb[x].range, &tlb[x]); 1424 1425 } 1426 UNSERIALIZE_SCALAR(sfar); 1427} 1428 1429} // namespace SparcISA 1430 1431SparcISA::TLB * 1432SparcTLBParams::create() 1433{ 1434 return new SparcISA::TLB(this); 1435} | 1415 if (tlb[x].valid) 1416 lookupTable.insert(tlb[x].range, &tlb[x]); 1417 1418 } 1419 UNSERIALIZE_SCALAR(sfar); 1420} 1421 1422} // namespace SparcISA 1423 1424SparcISA::TLB * 1425SparcTLBParams::create() 1426{ 1427 return new SparcISA::TLB(this); 1428} |