mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-10 00:41:26 +12:00
Memory mirror support
Implemented utils::memory_release (not used) Implemented utils::shm class (handler for shared memory) Improved sys_mmapper syscalls Rewritten ppu_patch function Implemented vm::get_super_ptr (ignores memory protection) Minimal allocation alignment increased to 0x10000
This commit is contained in:
parent
fe4c3c4d84
commit
5d15d64ec8
14 changed files with 541 additions and 232 deletions
|
@ -400,39 +400,32 @@ extern void ppu_remove_breakpoint(u32 addr)
|
|||
|
||||
extern bool ppu_patch(u32 addr, u32 value)
|
||||
{
|
||||
// TODO: check executable flag
|
||||
if (vm::check_addr(addr, sizeof(u32)))
|
||||
if (g_cfg.core.ppu_decoder == ppu_decoder_type::llvm && Emu.GetStatus() != system_state::ready)
|
||||
{
|
||||
if (g_cfg.core.ppu_decoder == ppu_decoder_type::llvm && Emu.GetStatus() != system_state::ready)
|
||||
{
|
||||
// TODO
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!vm::check_addr(addr, sizeof(u32), vm::page_writable))
|
||||
{
|
||||
utils::memory_protect(vm::g_base_addr + addr, sizeof(u32), utils::protection::rw);
|
||||
}
|
||||
|
||||
vm::write32(addr, value);
|
||||
|
||||
const u32 _break = ::narrow<u32>(reinterpret_cast<std::uintptr_t>(&ppu_break));
|
||||
const u32 fallback = ::narrow<u32>(reinterpret_cast<std::uintptr_t>(&ppu_fallback));
|
||||
|
||||
if (ppu_ref(addr) != _break && ppu_ref(addr) != fallback)
|
||||
{
|
||||
ppu_ref(addr) = ppu_cache(addr);
|
||||
}
|
||||
|
||||
if (!vm::check_addr(addr, sizeof(u32), vm::page_writable))
|
||||
{
|
||||
utils::memory_protect(vm::g_base_addr + addr, sizeof(u32), utils::protection::ro);
|
||||
}
|
||||
|
||||
return true;
|
||||
// TODO: support recompilers
|
||||
LOG_FATAL(GENERAL, "Patch failed at 0x%x: LLVM recompiler is used.", addr);
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
const auto ptr = vm::get_super_ptr<u32>(addr);
|
||||
|
||||
if (!ptr)
|
||||
{
|
||||
LOG_FATAL(GENERAL, "Patch failed at 0x%x: invalid memory address.", addr);
|
||||
return false;
|
||||
}
|
||||
|
||||
*ptr = value;
|
||||
|
||||
const u32 _break = ::narrow<u32>(reinterpret_cast<std::uintptr_t>(&ppu_break));
|
||||
const u32 fallback = ::narrow<u32>(reinterpret_cast<std::uintptr_t>(&ppu_fallback));
|
||||
|
||||
if (ppu_ref(addr) != _break && ppu_ref(addr) != fallback)
|
||||
{
|
||||
ppu_ref(addr) = ppu_cache(addr);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string ppu_thread::get_name() const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue