allow deallocations to unmap rsx mapped memory

This commit is contained in:
eladash 2018-05-27 13:48:21 +03:00 committed by kd-11
parent ce98c962f8
commit 23b380eb41
7 changed files with 84 additions and 64 deletions

View file

@ -11,6 +11,8 @@
#include "Capture/rsx_capture.h"
#include "rsx_methods.h"
#include "rsx_utils.h"
#include "Emu/Cell/lv2/sys_event.h"
#include "Emu/Cell/Modules/cellGcmSys.h"
#include "Utilities/GSL.h"
#include "Utilities/StrUtil.h"
@ -27,6 +29,8 @@ bool user_asked_for_frame_capture = false;
rsx::frame_trace_data frame_debug;
rsx::frame_capture_data frame_capture;
extern CellGcmOffsetTable offsetTable;
namespace rsx
{
std::function<bool(u32 addr, bool is_writing)> g_access_violation_handler;
@ -2332,6 +2336,28 @@ namespace rsx
void thread::on_notify_memory_unmapped(u32 base_address, u32 size)
{
{
s32 io_addr = RSXIOMem.getMappedAddress(base_address);
if (io_addr >= 0)
{
if (!isHLE)
{
const u64 unmap_key = u64((1ull << (size >> 20)) - 1) << ((io_addr >> 20) & 0x3f);
const u64 gcm_flag = 0x100000000ull << (io_addr >> 26);
sys_event_port_send(fxm::get<SysRsxConfig>()->rsx_event_port, 0, gcm_flag, unmap_key);
}
else
{
const u32 end = (base_address + size) >> 20;
for (base_address >>= 20, io_addr >>= 20; base_address < end;)
{
offsetTable.ioAddress[base_address++] = 0xFFFF;
offsetTable.eaAddress[io_addr++] = 0xFFFF;
}
}
}
}
writer_lock lock(m_mtx_task);
m_invalidated_memory_ranges.push_back({ base_address, size });
}