Merge pull request #2035 from magumagu/remove-bat-option

Remove the BAT checkbox/setting/implementation.
This commit is contained in:
magumagu 2015-02-15 17:27:18 -08:00
commit 5b6a947e8f
6 changed files with 7 additions and 83 deletions

View File

@ -47,7 +47,7 @@ namespace BootManager
// Apply fire liberally
struct ConfigCache
{
bool valid, bCPUThread, bSkipIdle, bFPRF, bBAT, bMMU, bDCBZOFF, m_EnableJIT, bDSPThread,
bool valid, bCPUThread, bSkipIdle, bFPRF, bMMU, bDCBZOFF, m_EnableJIT, bDSPThread,
bSyncGPU, bFastDiscSpeed, bDSPHLE, bHLE_BS2, bProgressive;
int iCPUCore, Volume;
int iWiimoteSource[MAX_BBMOTES];
@ -114,7 +114,6 @@ bool BootCore(const std::string& _rFilename)
config_cache.bSkipIdle = StartUp.bSkipIdle;
config_cache.iCPUCore = StartUp.iCPUCore;
config_cache.bFPRF = StartUp.bFPRF;
config_cache.bBAT = StartUp.bBAT;
config_cache.bMMU = StartUp.bMMU;
config_cache.bDCBZOFF = StartUp.bDCBZOFF;
config_cache.bSyncGPU = StartUp.bSyncGPU;
@ -154,7 +153,6 @@ bool BootCore(const std::string& _rFilename)
core_section->Get("CPUThread", &StartUp.bCPUThread, StartUp.bCPUThread);
core_section->Get("SkipIdle", &StartUp.bSkipIdle, StartUp.bSkipIdle);
core_section->Get("FPRF", &StartUp.bFPRF, StartUp.bFPRF);
core_section->Get("BAT", &StartUp.bBAT, StartUp.bBAT);
core_section->Get("MMU", &StartUp.bMMU, StartUp.bMMU);
core_section->Get("DCBZ", &StartUp.bDCBZOFF, StartUp.bDCBZOFF);
core_section->Get("SyncGPU", &StartUp.bSyncGPU, StartUp.bSyncGPU);
@ -281,7 +279,6 @@ void Stop()
StartUp.bSkipIdle = config_cache.bSkipIdle;
StartUp.iCPUCore = config_cache.iCPUCore;
StartUp.bFPRF = config_cache.bFPRF;
StartUp.bBAT = config_cache.bBAT;
StartUp.bMMU = config_cache.bMMU;
StartUp.bDCBZOFF = config_cache.bDCBZOFF;
StartUp.bSyncGPU = config_cache.bSyncGPU;

View File

@ -39,7 +39,7 @@ SCoreStartupParameter::SCoreStartupParameter()
bEnableMemcardSaving(true),
bDPL2Decoder(false), iLatency(14),
bRunCompareServer(false), bRunCompareClient(false),
bBAT(false), bMMU(false), bDCBZOFF(false),
bMMU(false), bDCBZOFF(false),
iBBDumpPort(0),
bSyncGPU(false), bFastDiscSpeed(false),
SelectedLanguage(0), bWii(false),
@ -74,7 +74,6 @@ void SCoreStartupParameter::LoadDefaults()
bDSPHLE = true;
bFastmem = true;
bFPRF = false;
bBAT = false;
bMMU = false;
bDCBZOFF = false;
iBBDumpPort = -1;

View File

@ -180,7 +180,6 @@ struct SCoreStartupParameter
bool bRunCompareServer;
bool bRunCompareClient;
bool bBAT;
bool bMMU;
bool bDCBZOFF;
int iBBDumpPort;

View File

@ -1013,79 +1013,12 @@ static __forceinline u32 TranslatePageAddress(const u32 address, const XCheckTLB
return 0;
}
#define BATU_BEPI(v) ((v)&0xfffe0000)
#define BATU_BL(v) (((v)&0x1ffc)>>2)
#define BATU_Vs (1<<1)
#define BATU_Vp (1)
#define BATL_BRPN(v) ((v)&0xfffe0000)
#define BAT_EA_OFFSET(v) ((v)&0x1ffff)
#define BAT_EA_11(v) ((v)&0x0ffe0000)
#define BAT_EA_4(v) ((v)&0xf0000000)
static inline bool CheckAddrBats(const u32 addr, u32* result, u32 batu, u32 spr)
{
for (int i = 0; i < 4; i++)
{
u32 bl17 = ~(BATU_BL(PowerPC::ppcState.spr[spr + i * 2]) << 17);
u32 addr2 = addr & (bl17 | 0xf001ffff);
if (BATU_BEPI(addr2) == BATU_BEPI(PowerPC::ppcState.spr[spr + i * 2]))
{
// bat applies to this address
if (PowerPC::ppcState.spr[spr + i * 2] & batu)
{
// bat entry valid
u32 offset = BAT_EA_OFFSET(addr);
u32 page = BAT_EA_11(addr);
page &= ~bl17;
page |= BATL_BRPN(PowerPC::ppcState.spr[spr + 1 + i * 2]);
// fixme: check access rights
*result = page | offset;
return true;
}
}
}
return false;
}
// Block Address Translation
static u32 TranslateBlockAddress(const u32 address, const XCheckTLBFlag flag)
{
u32 result = 0;
UReg_MSR& m_MSR = ((UReg_MSR&)PowerPC::ppcState.msr);
u32 batu = (m_MSR.PR ? BATU_Vp : BATU_Vs);
// Check for enhanced mode (secondary BAT enable) using 8 BATs
bool enhanced_bats = SConfig::GetInstance().m_LocalCoreStartupParameter.bWii && HID4.SBE;
if (flag != FLAG_OPCODE)
{
if (!CheckAddrBats(address, &result, batu, SPR_DBAT0U) && enhanced_bats)
CheckAddrBats(address, &result, batu, SPR_DBAT4U);
}
else
{
if (!CheckAddrBats(address, &result, batu, SPR_IBAT0U) && enhanced_bats)
CheckAddrBats(address, &result, batu, SPR_IBAT4U);
}
return result;
}
// Translate effective address using BAT or PAT. Returns 0 if the address cannot be translated.
template <const XCheckTLBFlag flag>
__forceinline u32 TranslateAddress(const u32 address)
{
// TODO: bBAT in theory should allow dynamic changes to the BAT registers.
// In reality, the option is mostly useless at the moment because we don't
// always translate addresses when we should. ReadFromHardware/WriteFromHardware,
// fastmem, the JIT cache, and some misc code in the JIT assume default BATs.
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bBAT)
{
u32 tlb_addr = TranslateBlockAddress(address, flag);
if (tlb_addr)
return tlb_addr;
}
// TODO: Perform BAT translation. (At the moment, we hardcode an assumed BAT
// configuration, so there's no reason to actually check the registers.)
return TranslatePageAddress(address, flag);
}

View File

@ -404,11 +404,9 @@ void CISOProperties::CreateGUIControls(bool IsWad)
SkipIdle = new wxCheckBox(m_GameConfig, ID_IDLESKIP, _("Enable Idle Skipping"), wxDefaultPosition, wxDefaultSize, GetElementStyle("Core", "SkipIdle"));
MMU = new wxCheckBox(m_GameConfig, ID_MMU, _("Enable MMU"), wxDefaultPosition, wxDefaultSize, GetElementStyle("Core", "MMU"));
MMU->SetToolTip(_("Enables the Memory Management Unit, needed for some games. (ON = Compatible, OFF = Fast)"));
BAT = new wxCheckBox(m_GameConfig, ID_MMU, _("Enable BAT"), wxDefaultPosition, wxDefaultSize, GetElementStyle("Core", "BAT"));
BAT->SetToolTip(_("Enables Block Address Translation, needed for a few games. Requires MMU. (ON = Compatible, OFF = Fast)"));
DCBZOFF = new wxCheckBox(m_GameConfig, ID_DCBZOFF, _("Skip DCBZ clearing"), wxDefaultPosition, wxDefaultSize, GetElementStyle("Core", "DCBZ"));
DCBZOFF->SetToolTip(_("Bypass the clearing of the data cache by the DCBZ instruction. Usually leave this option disabled."));
FPRF = new wxCheckBox(m_GameConfig, ID_MMU, _("Enable FPRF"), wxDefaultPosition, wxDefaultSize, GetElementStyle("Core", "FPRF"));
FPRF = new wxCheckBox(m_GameConfig, ID_FPRF, _("Enable FPRF"), wxDefaultPosition, wxDefaultSize, GetElementStyle("Core", "FPRF"));
FPRF->SetToolTip(_("Enables Floating Point Result Flag calculation, needed for a few games. (ON = Compatible, OFF = Fast)"));
SyncGPU = new wxCheckBox(m_GameConfig, ID_SYNCGPU, _("Synchronize GPU thread"), wxDefaultPosition, wxDefaultSize, GetElementStyle("Core", "SyncGPU"));
SyncGPU->SetToolTip(_("Synchronizes the GPU and CPU threads to help prevent random freezes in Dual Core mode. (ON = Compatible, OFF = Fast)"));
@ -464,7 +462,6 @@ void CISOProperties::CreateGUIControls(bool IsWad)
new wxStaticBoxSizer(wxVERTICAL, m_GameConfig, _("Core"));
sbCoreOverrides->Add(CPUThread, 0, wxLEFT, 5);
sbCoreOverrides->Add(SkipIdle, 0, wxLEFT, 5);
sbCoreOverrides->Add(BAT, 0, wxLEFT, 5);
sbCoreOverrides->Add(MMU, 0, wxLEFT, 5);
sbCoreOverrides->Add(DCBZOFF, 0, wxLEFT, 5);
sbCoreOverrides->Add(FPRF, 0, wxLEFT, 5);
@ -1055,7 +1052,6 @@ void CISOProperties::LoadGameConfig()
SetCheckboxValueFromGameini("Core", "CPUThread", CPUThread);
SetCheckboxValueFromGameini("Core", "SkipIdle", SkipIdle);
SetCheckboxValueFromGameini("Core", "MMU", MMU);
SetCheckboxValueFromGameini("Core", "BAT", BAT);
SetCheckboxValueFromGameini("Core", "DCBZ", DCBZOFF);
SetCheckboxValueFromGameini("Core", "FPRF", FPRF);
SetCheckboxValueFromGameini("Core", "SyncGPU", SyncGPU);
@ -1150,7 +1146,6 @@ bool CISOProperties::SaveGameConfig()
SaveGameIniValueFrom3StateCheckbox("Core", "CPUThread", CPUThread);
SaveGameIniValueFrom3StateCheckbox("Core", "SkipIdle", SkipIdle);
SaveGameIniValueFrom3StateCheckbox("Core", "MMU", MMU);
SaveGameIniValueFrom3StateCheckbox("Core", "BAT", BAT);
SaveGameIniValueFrom3StateCheckbox("Core", "DCBZ", DCBZOFF);
SaveGameIniValueFrom3StateCheckbox("Core", "FPRF", FPRF);
SaveGameIniValueFrom3StateCheckbox("Core", "SyncGPU", SyncGPU);

View File

@ -69,7 +69,7 @@ private:
DECLARE_EVENT_TABLE();
// Core
wxCheckBox *CPUThread, *SkipIdle, *MMU, *BAT, *DCBZOFF, *FPRF;
wxCheckBox *CPUThread, *SkipIdle, *MMU, *DCBZOFF, *FPRF;
wxCheckBox *SyncGPU, *FastDiscSpeed, *DSPHLE;
wxArrayString arrayStringFor_GPUDeterminism;
@ -136,6 +136,7 @@ private:
ID_IDLESKIP,
ID_MMU,
ID_DCBZOFF,
ID_FPRF,
ID_SYNCGPU,
ID_DISCSPEED,
ID_AUDIO_DSP_HLE,