mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-15 23:42:36 +00:00
memory fix
This commit is contained in:
parent
73906f9f29
commit
bb111d325f
@ -207,9 +207,9 @@ struct MemoryManager final : llvm::RTDyldMemoryManager
|
|||||||
LOG_FATAL(GENERAL, "VirtualFree(%p) failed! Error %u", s_memory, GetLastError());
|
LOG_FATAL(GENERAL, "VirtualFree(%p) failed! Error %u", s_memory, GetLastError());
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (::mprotect(s_memory, s_memory_size, PROT_NONE))
|
if (!::mmap(s_memory, s_memory_size, PROT_NONE, MAP_FIXED | MAP_ANON | MAP_PRIVATE, -1, 0))
|
||||||
{
|
{
|
||||||
LOG_FATAL(GENERAL, "mprotect(%p) failed! Error %d", s_memory, errno);
|
LOG_FATAL(GENERAL, "mmap(%p) failed! Error %d", s_memory, errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: unregister EH frames if necessary
|
// TODO: unregister EH frames if necessary
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
namespace memory_helper
|
namespace memory_helper
|
||||||
{
|
{
|
||||||
void* reserve_memory(size_t size)
|
void* reserve_memory(std::size_t size)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
return verify("reserve_memory" HERE, VirtualAlloc(NULL, size, MEM_RESERVE, PAGE_NOACCESS));
|
return verify("reserve_memory" HERE, VirtualAlloc(NULL, size, MEM_RESERVE, PAGE_NOACCESS));
|
||||||
@ -22,21 +22,21 @@ namespace memory_helper
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void commit_page_memory(void* pointer, size_t size)
|
void commit_page_memory(void* pointer, std::size_t size)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
verify(HERE), VirtualAlloc(pointer, size, MEM_COMMIT, PAGE_READWRITE);
|
verify(HERE), VirtualAlloc(pointer, size, MEM_COMMIT, PAGE_READWRITE);
|
||||||
#else
|
#else
|
||||||
verify(HERE), ::mprotect((void*)((u64)pointer & -4096), size, PROT_READ | PROT_WRITE) != -1;
|
verify(HERE), ::mprotect((void*)((u64)pointer & -4096), ::align(size, 4096), PROT_READ | PROT_WRITE) != -1;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void free_reserved_memory(void* pointer, size_t size)
|
void free_reserved_memory(void* pointer, std::size_t size)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
verify(HERE), VirtualFree(pointer, 0, MEM_DECOMMIT);
|
verify(HERE), VirtualFree(pointer, 0, MEM_DECOMMIT);
|
||||||
#else
|
#else
|
||||||
verify(HERE), ::mprotect(pointer, size, PROT_NONE) != -1;
|
verify(HERE), ::mmap(pointer, size, PROT_NONE, MAP_FIXED | MAP_ANON | MAP_PRIVATE, -1, 0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -73,6 +73,11 @@ extern void ppu_execute_function(ppu_thread& ppu, u32 index);
|
|||||||
|
|
||||||
const auto s_ppu_compiled = static_cast<u32*>(memory_helper::reserve_memory(0x100000000));
|
const auto s_ppu_compiled = static_cast<u32*>(memory_helper::reserve_memory(0x100000000));
|
||||||
|
|
||||||
|
extern void ppu_finalize()
|
||||||
|
{
|
||||||
|
memory_helper::free_reserved_memory(s_ppu_compiled, 0x100000000);
|
||||||
|
}
|
||||||
|
|
||||||
// Get interpreter cache value
|
// Get interpreter cache value
|
||||||
static u32 ppu_cache(u32 addr)
|
static u32 ppu_cache(u32 addr)
|
||||||
{
|
{
|
||||||
|
@ -50,6 +50,7 @@ extern void ppu_load_exec(const ppu_exec_object&);
|
|||||||
extern void spu_load_exec(const spu_exec_object&);
|
extern void spu_load_exec(const spu_exec_object&);
|
||||||
extern void arm_load_exec(const arm_exec_object&);
|
extern void arm_load_exec(const arm_exec_object&);
|
||||||
extern std::shared_ptr<struct lv2_prx> ppu_load_prx(const ppu_prx_object&);
|
extern std::shared_ptr<struct lv2_prx> ppu_load_prx(const ppu_prx_object&);
|
||||||
|
extern void ppu_finalize();
|
||||||
|
|
||||||
fs::file g_tty;
|
fs::file g_tty;
|
||||||
|
|
||||||
@ -460,6 +461,7 @@ void Emulator::Stop()
|
|||||||
|
|
||||||
RSXIOMem.Clear();
|
RSXIOMem.Clear();
|
||||||
vm::close();
|
vm::close();
|
||||||
|
ppu_finalize();
|
||||||
|
|
||||||
if (g_cfg_autoexit)
|
if (g_cfg_autoexit)
|
||||||
{
|
{
|
||||||
|
@ -424,7 +424,7 @@ void InterpreterDisAsmFrame::DoRun(wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
if (cpu && cpu->state.test_and_reset(cpu_flag::dbg_pause))
|
if (cpu && cpu->state.test_and_reset(cpu_flag::dbg_pause))
|
||||||
{
|
{
|
||||||
if (!test(cpu->state, cpu_state_pause))
|
if (!test(cpu->state, cpu_flag::dbg_pause + cpu_flag::dbg_global_pause))
|
||||||
{
|
{
|
||||||
cpu->notify();
|
cpu->notify();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user