Remove the BAT checkbox/setting/implementation.

The current version of the setting is useless, and the real implementation
(PR1882) will be always-on, and won't use any of the existing code.
This commit is contained in:
magumagu committed 2015-02-11 20:24:51 -08:00
1 parent 20aa937824
commit aa40f750d4
6 files changed
+7 -83

No files matched your search

+1 -4
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;
+1 -2
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;
-1
View File
@@ -180,7 +180,6 @@ struct SCoreStartupParameter
bool bRunCompareServer;
bool bRunCompareClient;
bool bBAT;
bool bMMU;
bool bDCBZOFF;
int iBBDumpPort;
+2 -69
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);
}