mmu: fix macos crash. only flush user mem in address lut

force rtt2vram for JSR (custom graffiti)
clean up vmem32 remains
missing host_context.h change
gh action: build sdl from source on macos
This commit is contained in:
Flyinghead 2021-05-18 12:53:14 +02:00
parent a56f45af98
commit 3a1ae0db00
8 changed files with 28 additions and 47 deletions

View File

@ -19,7 +19,10 @@ jobs:
steps:
- name: Set up build environment (macos-latest)
run: |
brew install ccache flac libao libomp pulseaudio sdl2 zlib
brew install ccache flac libao libomp pulseaudio zlib
cd shell/apple
mkdir artifacts
brew install --build-from-source ./sdl2.rb
echo "/usr/local/opt/ccache/libexec" >> $GITHUB_PATH
echo "CCACHE_DIR=/tmp/ccache" >> $GITHUB_ENV
if: matrix.config.os == 'macos-latest'

View File

@ -25,7 +25,6 @@ namespace config {
Option<bool> DynarecEnabled("Dynarec.Enabled", true);
Option<bool> DynarecIdleSkip("Dynarec.idleskip", true);
Option<bool> DynarecSafeMode("Dynarec.safe-mode");
Option<bool> DisableVmem32("Dynarec.DisableVmem32");
// General

View File

@ -288,7 +288,6 @@ public:
extern Option<bool> DynarecEnabled;
extern Option<bool> DynarecIdleSkip;
extern Option<bool> DynarecSafeMode;
extern Option<bool> DisableVmem32;
// General

View File

@ -529,6 +529,9 @@ void MMU_init()
}
}
mmu_set_state();
// pre-fill kernel memory
for (int vpn = ARRAY_SIZE(mmuAddressLUT) / 2; vpn < ARRAY_SIZE(mmuAddressLUT); vpn++)
mmuAddressLUT[vpn] = vpn << 12;
}

View File

@ -126,11 +126,11 @@ extern u32 mmuAddressLUT[0x100000];
static inline void mmuAddressLUTFlush(bool full) {
if (full)
memset(mmuAddressLUT, 0, sizeof(mmuAddressLUT));
memset(mmuAddressLUT, 0, sizeof(mmuAddressLUT) / 2); // flush user memory
else
{
constexpr u32 slotPages = (32 * 1024 * 1024) >> 12;
memset(mmuAddressLUT, 0, slotPages * sizeof(u32)); // flush slot 0
memset(mmuAddressLUT, 0, slotPages * sizeof(u32)); // flush slot 0
}
}
@ -152,7 +152,8 @@ static inline u32 mmuDynarecLookup(u32 vaddr, u32 write, u32 pc)
// not reached
return 0;
}
mmuAddressLUT[vaddr >> 12] = paddr & ~0xfff;
if (vaddr >> 31 == 0)
mmuAddressLUT[vaddr >> 12] = paddr & ~0xfff;
return paddr;
}

View File

@ -128,7 +128,13 @@ static void LoadSpecialSettings()
// Tom Clancy's Rainbow Six (US)
|| prod_id == "T40401N"
// Tom Clancy's Rainbow Six incl. Eagle Watch Missions (EU)
|| prod_id == "T-45001D05")
|| prod_id == "T-45001D05"
// Jet Grind Radio (US)
|| prod_id == "MK-51058"
// JSR (JP)
|| prod_id == "HDR-0078"
// JSR (EU)
|| prod_id == "MK-5105850")
{
INFO_LOG(BOOT, "Enabling render to texture buffer for game %s", prod_id.c_str());
config::RenderToTextureBuffer.override(true);
@ -157,40 +163,7 @@ static void LoadSpecialSettings()
INFO_LOG(BOOT, "Enabling Extra depth scaling for game %s", prod_id.c_str());
config::ExtraDepthScale.override(1e26f);
}
// Super Producers
if (prod_id == "T14303M"
// Giant Killers
|| prod_id == "T45401D 50"
// Wild Metal (US)
|| prod_id == "T42101N 00"
// Wild Metal (EU)
|| prod_id == "T40501D-50"
// Resident Evil 2 (US)
|| prod_id == "T1205N"
// Resident Evil 2 (EU)
|| prod_id == "T7004D 50"
// Rune Jade
|| prod_id == "T14304M"
// Marionette Company
|| prod_id == "T5202M"
// Marionette Company 2
|| prod_id == "T5203M"
// Maximum Pool (for online support)
|| prod_id == "T11010N"
// StarLancer (US) (for online support)
|| prod_id == "T40209N"
// StarLancer (EU) (for online support)
|| prod_id == "T17723D 05"
// Heroes of might and magic III
|| prod_id == "T0000M"
// WebTV
|| prod_id == "6107117" || prod_id == "610-7390" || prod_id == "610-7391"
// PBA
|| prod_id == "T26702N")
{
INFO_LOG(BOOT, "Disabling 32-bit virtual memory for game %s", prod_id.c_str());
config::DisableVmem32.override(true);
}
std::string areas(ip_meta.area_symbols, sizeof(ip_meta.area_symbols));
bool region_usa = areas.find('U') != std::string::npos;
bool region_eu = areas.find('E') != std::string::npos;
@ -940,9 +913,7 @@ void dc_loadstate()
#if FEAT_AREC == DYNAREC_JIT
aicaarm::recompiler::flush();
#endif
#ifndef NO_MMU
mmu_flush_table();
#endif
#if FEAT_SHREC != DYNAREC_NONE
bm_Reset();
#endif

View File

@ -20,8 +20,5 @@ struct host_context_t {
#endif
#elif HOST_CPU == CPU_ARM
u32 reg[15];
#elif HOST_CPU == CPU_ARM64
u64 sp;
u64 x2;
#endif
};

View File

@ -775,7 +775,15 @@ private:
mov(eax, call_regs[0]);
shr(eax, 12);
mov(eax, dword[(uintptr_t)mmuAddressLUT + rax * 4]);
if ((uintptr_t)mmuAddressLUT >> 32 != 0)
{
mov(r9, (uintptr_t)mmuAddressLUT);
mov(eax, dword[r9 + rax * 4]);
}
else
{
mov(eax, dword[(uintptr_t)mmuAddressLUT + rax * 4]);
}
test(eax, eax);
jne(inCache);
mov(call_regs[1], write);