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(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 |
1363 std::vector<int> free_list; 1364 for (const TlbEntry *entry : freeList) 1365 free_list.push_back(entry - tlb); |
1366 |
1367 SERIALIZE_CONTAINER(free_list); 1368 |
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++) { |
1379 ScopedCheckpointSection sec(cp, csprintf("PTE%d", x)); 1380 tlb[x].serialize(cp); |
1381 } 1382 SERIALIZE_SCALAR(sfar); 1383} 1384 1385void |
1386TLB::unserialize(CheckpointIn &cp) |
1387{ 1388 int oldSize; 1389 |
1390 paramIn(cp, "size", oldSize); |
1391 if (oldSize != size) 1392 panic("Don't support unserializing different sized TLBs\n"); 1393 UNSERIALIZE_SCALAR(usedEntries); 1394 UNSERIALIZE_SCALAR(lastReplaced); 1395 |
1396 std::vector<int> free_list; 1397 UNSERIALIZE_CONTAINER(free_list); |
1398 freeList.clear(); |
1399 for (int idx : free_list) 1400 freeList.push_back(&tlb[idx]); |
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++) { |
1413 ScopedCheckpointSection sec(cp, csprintf("PTE%d", x)); 1414 tlb[x].unserialize(cp); |
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} |