Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make vm::_test_map aware of overflow #7940

Merged
merged 4 commits into from Apr 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 12 additions & 4 deletions rpcs3/Emu/Memory/vm.cpp
Expand Up @@ -9,6 +9,7 @@
#include "Utilities/cond.h"
#include "Utilities/Thread.h"
#include "Utilities/VirtualMemory.h"
#include "Utilities/address_range.h"
#include "Utilities/asm.h"
#include "Emu/CPU/CPUThread.h"
#include "Emu/Cell/lv2/sys_memory.h"
Expand Down Expand Up @@ -888,14 +889,21 @@ namespace vm

static bool _test_map(u32 addr, u32 size)
{
const auto range = utils::address_range::start_length(addr, size);

if (!range.valid())
{
return false;
}

for (auto& block : g_locations)
{
if (block && block->addr >= addr && block->addr <= addr + size - 1)
if (!block)
{
return false;
continue;
}

if (block && addr >= block->addr && addr <= block->addr + block->size - 1)
if (range.overlaps(utils::address_range::start_length(block->addr, block->size)))
{
return false;
}
Expand Down Expand Up @@ -990,7 +998,7 @@ namespace vm
}

// Return if size is invalid
if (!size || size > 0x40000000)
if (!size)
{
return nullptr;
}
Expand Down
6 changes: 3 additions & 3 deletions rpcs3/Emu/RSX/RSXThread.cpp
Expand Up @@ -2272,12 +2272,12 @@ namespace rsx
{
const u64 current_time = get_system_time();

if (recovered_fifo_cmds_history.size() == 9u)
if (recovered_fifo_cmds_history.size() == 20u)
{
const auto cmd_info = recovered_fifo_cmds_history.front();

// Check timestamp of last tracked cmd
if (current_time - cmd_info.timestamp < 1'500'000u)
if (current_time - cmd_info.timestamp < 2'000'000u)
{
// Probably hopeless
fmt::throw_exception("Dead FIFO commands queue state has been detected!\nTry increasing \"Driver Wake-Up Delay\" setting in Advanced settings." HERE);
Expand All @@ -2290,7 +2290,7 @@ namespace rsx
// Error. Should reset the queue
fifo_ctrl->set_get(restore_point);
fifo_ret_addr = saved_fifo_ret;
std::this_thread::sleep_for(1ms);
std::this_thread::sleep_for(2ms);
fifo_ctrl->abort();

if (std::exchange(in_begin_end, false) && !rsx::method_registers.current_draw_clause.empty())
Expand Down