mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-03-12 22:14:58 +00:00
vm: lock memory under "sudo" addr
Remove memory touching from transactions.
This commit is contained in:
parent
e98eb4659e
commit
083397a555
@ -1371,7 +1371,6 @@ const auto ppu_stcx_accurate_tx = build_function_asm<u64(*)(u32 raddr, u64 rtime
|
||||
c.jae(fall);
|
||||
});
|
||||
c.bt(x86::dword_ptr(args[2], ::offset32(&spu_thread::state) - ::offset32(&ppu_thread::rdata)), static_cast<u32>(cpu_flag::pause));
|
||||
c.mov(x86::eax, _XABORT_EXPLICIT);
|
||||
c.jc(fall);
|
||||
c.xbegin(tx0);
|
||||
c.mov(x86::rax, x86::qword_ptr(x86::rbx));
|
||||
@ -1453,18 +1452,10 @@ const auto ppu_stcx_accurate_tx = build_function_asm<u64(*)(u32 raddr, u64 rtime
|
||||
c.bind(skip);
|
||||
c.xend();
|
||||
build_get_tsc(c, stamp1);
|
||||
c.mov(x86::eax, _XABORT_EXPLICIT);
|
||||
//c.jmp(fall);
|
||||
|
||||
c.bind(fall);
|
||||
|
||||
// Touch memory if transaction failed with status 0
|
||||
c.test(x86::eax, x86::eax);
|
||||
c.jnz(next);
|
||||
c.xor_(x86::rbp, 0xf80);
|
||||
c.lock().add(x86::dword_ptr(x86::rbp), 0);
|
||||
c.xor_(x86::rbp, 0xf80);
|
||||
|
||||
Label fall2 = c.newLabel();
|
||||
Label fail2 = c.newLabel();
|
||||
Label fail3 = c.newLabel();
|
||||
|
@ -476,7 +476,6 @@ const auto spu_putllc_tx = build_function_asm<u64(*)(u32 raddr, u64 rtime, void*
|
||||
c.jae(fall);
|
||||
});
|
||||
c.bt(x86::dword_ptr(args[2], ::offset32(&spu_thread::state) - ::offset32(&spu_thread::rdata)), static_cast<u32>(cpu_flag::pause));
|
||||
c.mov(x86::eax, _XABORT_EXPLICIT);
|
||||
c.jc(fall);
|
||||
c.xbegin(tx0);
|
||||
c.mov(x86::rax, x86::qword_ptr(x86::rbx));
|
||||
@ -576,18 +575,10 @@ const auto spu_putllc_tx = build_function_asm<u64(*)(u32 raddr, u64 rtime, void*
|
||||
c.xend();
|
||||
c.add(x86::qword_ptr(args[2], ::offset32(&spu_thread::stx) - ::offset32(&spu_thread::rdata)), 1);
|
||||
build_get_tsc(c, stamp1);
|
||||
c.mov(x86::eax, _XABORT_EXPLICIT);
|
||||
//c.jmp(fall);
|
||||
|
||||
c.bind(fall);
|
||||
|
||||
// Touch memory if transaction failed with status 0
|
||||
c.test(x86::eax, x86::eax);
|
||||
c.jnz(next);
|
||||
c.xor_(x86::rbp, 0xf80);
|
||||
c.lock().add(x86::dword_ptr(x86::rbp), 0);
|
||||
c.xor_(x86::rbp, 0xf80);
|
||||
|
||||
Label fall2 = c.newLabel();
|
||||
Label fail2 = c.newLabel();
|
||||
Label fail3 = c.newLabel();
|
||||
@ -900,18 +891,10 @@ const auto spu_putlluc_tx = build_function_asm<u64(*)(u32 raddr, const void* rda
|
||||
c.xend();
|
||||
c.add(x86::qword_ptr(args[2], ::offset32(&spu_thread::stx)), 1);
|
||||
build_get_tsc(c, stamp1);
|
||||
c.mov(x86::eax, _XABORT_EXPLICIT);
|
||||
//c.jmp(fall);
|
||||
|
||||
c.bind(fall);
|
||||
|
||||
// Touch memory if transaction failed with status 0
|
||||
c.test(x86::eax, x86::eax);
|
||||
c.jnz(next);
|
||||
c.xor_(x86::rbp, 0xf80);
|
||||
c.lock().add(x86::dword_ptr(x86::rbp), 0);
|
||||
c.xor_(x86::rbp, 0xf80);
|
||||
|
||||
Label fall2 = c.newLabel();
|
||||
|
||||
// Lightened transaction
|
||||
|
@ -770,6 +770,10 @@ namespace vm
|
||||
|
||||
// Unlock
|
||||
g_range_lock.release(0);
|
||||
|
||||
perf_meter<"PAGE_LCK"_u64> perf1;
|
||||
|
||||
utils::memory_lock(g_base_addr + addr, size);
|
||||
}
|
||||
|
||||
bool page_protect(u32 addr, u32 size, u8 flags_test, u8 flags_set, u8 flags_clear)
|
||||
|
@ -160,12 +160,6 @@ namespace vm
|
||||
#endif
|
||||
stamp1 = __rdtsc();
|
||||
|
||||
// Touch memory if transaction failed with status 0
|
||||
if (!status)
|
||||
{
|
||||
reinterpret_cast<atomic_t<u8>*>(sptr)->fetch_add(0);
|
||||
}
|
||||
|
||||
// Stage 2: try to lock reservation first
|
||||
_old = res.fetch_add(1);
|
||||
|
||||
|
@ -292,6 +292,7 @@ int main(int argc, char** argv)
|
||||
#ifdef _WIN32
|
||||
ULONG64 intro_cycles{};
|
||||
QueryThreadCycleTime(GetCurrentThread(), &intro_cycles);
|
||||
verify("SetProcessWorkingSetSize" HERE), SetProcessWorkingSetSize(GetCurrentProcess(), 0x60000000, 0x80000000); // 2GiB
|
||||
#elif defined(RUSAGE_THREAD)
|
||||
struct ::rusage intro_stats{};
|
||||
::getrusage(RUSAGE_THREAD, &intro_stats);
|
||||
|
Loading…
x
Reference in New Issue
Block a user