Deleted Added
sdiff udiff text old ( 10824:308771bd2647 ) new ( 10905:a6ca6831e775 )
full compact
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)
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);
1373
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++) {
1384 nameOut(os, csprintf("%s.PTE%d", name(), x));
1385 tlb[x].serialize(os);
1386 }
1387 SERIALIZE_SCALAR(sfar);
1388}
1389
1390void
1391TLB::unserialize(Checkpoint *cp, const std::string &section)
1392{
1393 int oldSize;
1394
1395 paramIn(cp, section, "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
1401 int cntr;
1402 UNSERIALIZE_SCALAR(cntr);
1403
1404 int *free_list = (int*)malloc(sizeof(int) * cntr);
1405 freeList.clear();
1406 UNSERIALIZE_ARRAY(free_list, cntr);
1407 for (int x = 0; x < cntr; x++)
1408 freeList.push_back(&tlb[free_list[x]]);
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++) {
1421 tlb[x].unserialize(cp, csprintf("%s.PTE%d", section, x));
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}