Merge pull request #4687 from lioncash/ppc-state

PowerPC: Explicitly savestate PowerPCState members
This commit is contained in:
Matthew Parlane 2017-01-20 17:51:42 +13:00 committed by GitHub
commit 25c779943b
4 changed files with 41 additions and 4 deletions

View File

@ -2,12 +2,14 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "Core/PowerPC/PPCCache.h"
#include <cstring>
#include "Common/ChunkFile.h"
#include "Common/CommonFuncs.h"
#include "Core/HW/Memmap.h"
#include "Core/PowerPC/JitInterface.h"
#include "Core/PowerPC/PPCCache.h"
#include "Core/PowerPC/PowerPC.h"
namespace PowerPC
@ -148,4 +150,17 @@ u32 InstructionCache::ReadInstruction(u32 addr)
u32 res = Common::swap32(data[set][t][(addr >> 2) & 7]);
return res;
}
void InstructionCache::DoState(PointerWrap& p)
{
p.DoArray(data);
p.DoArray(tags);
p.DoArray(plru);
p.DoArray(valid);
p.DoArray(way_from_valid);
p.DoArray(way_from_plru);
p.DoArray(lookup_table);
p.DoArray(lookup_table_ex);
p.DoArray(lookup_table_vmem);
}
} // namespace PowerPC

View File

@ -6,6 +6,8 @@
#include "Common/CommonTypes.h"
class PointerWrap;
namespace PowerPC
{
const u32 ICACHE_SETS = 128;
@ -35,5 +37,6 @@ struct InstructionCache
void Invalidate(u32 addr);
void Init();
void Reset();
void DoState(PointerWrap& p);
};
}
} // namespace PowerPC

View File

@ -72,7 +72,26 @@ void DoState(PointerWrap& p)
// *((u64 *)&TL) = SystemTimers::GetFakeTimeBase(); //works since we are little endian and TL
// comes first :)
p.DoPOD(ppcState);
p.DoArray(ppcState.gpr);
p.Do(ppcState.pc);
p.Do(ppcState.npc);
p.DoArray(ppcState.cr_val);
p.Do(ppcState.msr);
p.Do(ppcState.fpscr);
p.Do(ppcState.Exceptions);
p.Do(ppcState.downcount);
p.Do(ppcState.xer_ca);
p.Do(ppcState.xer_so_ov);
p.Do(ppcState.xer_stringctrl);
p.DoArray(ppcState.ps);
p.DoArray(ppcState.sr);
p.DoArray(ppcState.spr);
p.DoArray(ppcState.tlb);
p.Do(ppcState.pagetable_base);
p.Do(ppcState.pagetable_hashmask);
ppcState.iCache.DoState(p);
if (p.GetMode() == PointerWrap::MODE_READ)
{
IBATUpdated();

View File

@ -71,7 +71,7 @@ static Common::Event g_compressAndDumpStateSyncEvent;
static std::thread g_save_thread;
// Don't forget to increase this after doing changes on the savestate system
static const u32 STATE_VERSION = 70; // Last changed in PR 4679
static const u32 STATE_VERSION = 71; // Last changed in PR 4687
// Maps savestate versions to Dolphin versions.
// Versions after 42 don't need to be added to this list,