mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-25 20:22:30 +01:00
Replaces page fault triggers with assembly
This commit is contained in:
parent
fa7ef870dd
commit
7d55a85fa6
@ -3721,7 +3721,7 @@ bool spu_thread::do_putllc(const spu_mfc_cmd& args)
|
|||||||
|
|
||||||
if (!vm::check_addr(addr, vm::page_writable))
|
if (!vm::check_addr(addr, vm::page_writable))
|
||||||
{
|
{
|
||||||
vm::_ref<atomic_t<u8>>(addr) += 0; // Access violate
|
utils::trigger_write_page_fault(vm::base(addr));
|
||||||
}
|
}
|
||||||
|
|
||||||
raddr = 0;
|
raddr = 0;
|
||||||
@ -3823,7 +3823,7 @@ void do_cell_atomic_128_store(u32 addr, const void* to_write)
|
|||||||
else if (!g_use_rtm)
|
else if (!g_use_rtm)
|
||||||
{
|
{
|
||||||
// Provoke page fault
|
// Provoke page fault
|
||||||
vm::_ref<atomic_t<u32>>(addr) += 0;
|
utils::trigger_write_page_fault(vm::base(addr));
|
||||||
|
|
||||||
// Hard lock
|
// Hard lock
|
||||||
auto spu = cpu ? cpu->try_get<spu_thread>() : nullptr;
|
auto spu = cpu ? cpu->try_get<spu_thread>() : nullptr;
|
||||||
|
@ -237,7 +237,7 @@ namespace vm
|
|||||||
|
|
||||||
// Try triggering a page fault (write)
|
// Try triggering a page fault (write)
|
||||||
// TODO: Read memory if needed
|
// TODO: Read memory if needed
|
||||||
vm::_ref<atomic_t<u8>>(test / 4096 == begin / 4096 ? begin : test) += 0;
|
utils::trigger_write_page_fault(vm::base(test / 4096 == begin / 4096 ? begin : test));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include "util/types.hpp"
|
#include "util/types.hpp"
|
||||||
#include "util/tsc.hpp"
|
#include "util/tsc.hpp"
|
||||||
|
#include "util/atomic.hpp"
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
extern bool g_use_rtm;
|
extern bool g_use_rtm;
|
||||||
@ -435,6 +436,15 @@ namespace utils
|
|||||||
return factor1 > 0 && T{umax} / factor1 < factor2 ? T{umax} : static_cast<T>(factor1 * factor2);
|
return factor1 > 0 && T{umax} / factor1 < factor2 ? T{umax} : static_cast<T>(factor1 * factor2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void trigger_write_page_fault(void* ptr)
|
||||||
|
{
|
||||||
|
#if defined(ARCH_X64) && !defined(_MSC_VER)
|
||||||
|
__asm__ volatile("lock orl $0, 0(%0)" :: "r" (ptr));
|
||||||
|
#else
|
||||||
|
*static_cast<atomic_t<u32> *>(ptr) += 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
inline void trap()
|
inline void trap()
|
||||||
{
|
{
|
||||||
#ifdef _M_X64
|
#ifdef _M_X64
|
||||||
|
Loading…
Reference in New Issue
Block a user