Skip to content

Commit

Permalink
Adding MMU state values to state
Browse files Browse the repository at this point in the history
because that allow the MMU state to be loaded
  • Loading branch information
john-peterson committed May 22, 2013
1 parent 2f00f87 commit f452a64
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
11 changes: 4 additions & 7 deletions Source/Core/Core/Src/HW/MemmapFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -598,9 +598,6 @@ union UPTE2
u32 Hex;
};

u32 pagetable_base = 0;
u32 pagetable_hashmask = 0;

void GenerateDSIException(u32 _EffectiveAddress, bool _bWrite)
{
if (_bWrite)
Expand Down Expand Up @@ -644,8 +641,8 @@ void SDRUpdated()
{
return;
}
pagetable_base = htaborg<<16;
pagetable_hashmask = ((xx<<10)|0x3ff);
PowerPC::ppcState.pagetable_base = htaborg<<16;
PowerPC::ppcState.pagetable_hashmask = ((xx<<10)|0x3ff);
}


Expand Down Expand Up @@ -821,7 +818,7 @@ u32 TranslatePageAddress(const u32 _Address, const XCheckTLBFlag _Flag)

// hash function no 1 "xor" .360
u32 hash1 = (VSID ^ page_index);
u32 pteg_addr = ((hash1 & pagetable_hashmask) << 6) | pagetable_base;
u32 pteg_addr = ((hash1 & PowerPC::ppcState.pagetable_hashmask) << 6) | PowerPC::ppcState.pagetable_base;

// hash1
for (int i = 0; i < 8; i++)
Expand Down Expand Up @@ -856,7 +853,7 @@ u32 TranslatePageAddress(const u32 _Address, const XCheckTLBFlag _Flag)

// hash function no 2 "not" .360
hash1 = ~hash1;
pteg_addr = ((hash1 & pagetable_hashmask) << 6) | pagetable_base;
pteg_addr = ((hash1 & PowerPC::ppcState.pagetable_hashmask) << 6) | PowerPC::ppcState.pagetable_base;
for (int i = 0; i < 8; i++)
{
u32 pte = bswap(*(u32*)&pRAM[pteg_addr]);
Expand Down
2 changes: 2 additions & 0 deletions Source/Core/Core/Src/PowerPC/PowerPC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ void Init(int cpu_core)
ppcState.itlb_last = 0;
memset(ppcState.itlb_va, 0, sizeof(ppcState.itlb_va));
memset(ppcState.itlb_pa, 0, sizeof(ppcState.itlb_pa));
ppcState.pagetable_base = 0;
ppcState.pagetable_hashmask = 0;

ResetRegisters();
PPCTables::InitTables(cpu_core);
Expand Down
3 changes: 3 additions & 0 deletions Source/Core/Core/Src/PowerPC/PowerPC.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ struct GC_ALIGNED64(PowerPCState)
u32 itlb_va[128];
u32 itlb_pa[128];

u32 pagetable_base;
u32 pagetable_hashmask;

InstructionCache iCache;
};

Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/Src/State.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,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 = 18;
static const u32 STATE_VERSION = 19;

enum
{
Expand Down

0 comments on commit f452a64

Please sign in to comment.