1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-23 11:13:19 +01:00

PPU/SPU transactions: ease cache line interference (TSX path)

Touch memory on the same memory page, but different cache lines.
This commit is contained in:
Nekotekina 2019-04-02 13:12:05 +03:00
parent 12dc3c1872
commit 3354f068fc
2 changed files with 20 additions and 0 deletions

View File

@ -1054,8 +1054,12 @@ const auto ppu_stwcx_tx = build_function_asm<bool(*)(u32 raddr, u64 rtime, u64 r
c.jz(fail);
c.sar(x86::eax, 24);
c.js(fail);
c.xor_(x86::r11, 0xf80);
c.xor_(x86::r10, 0xf80);
c.lock().add(x86::dword_ptr(x86::r11), 0);
c.lock().add(x86::qword_ptr(x86::r10), 0);
c.xor_(x86::r11, 0xf80);
c.xor_(x86::r10, 0xf80);
c.jmp(begin);
c.bind(fail);
@ -1148,8 +1152,12 @@ const auto ppu_stdcx_tx = build_function_asm<bool(*)(u32 raddr, u64 rtime, u64 r
c.jz(fail);
c.sar(x86::eax, 24);
c.js(fail);
c.xor_(x86::r11, 0xf80);
c.xor_(x86::r10, 0xf80);
c.lock().add(x86::qword_ptr(x86::r11), 0);
c.lock().add(x86::qword_ptr(x86::r10), 0);
c.xor_(x86::r11, 0xf80);
c.xor_(x86::r10, 0xf80);
c.jmp(begin);
c.bind(fail);

View File

@ -247,8 +247,12 @@ const auto spu_putllc_tx = build_function_asm<u32(*)(u32 raddr, u64 rtime, const
c.js(fail);
c.sub(args[0].r32(), 1);
c.jz(retry);
c.xor_(x86::r11, 0xf80);
c.xor_(x86::r10, 0xf80);
c.lock().add(x86::qword_ptr(x86::r11), 0);
c.lock().add(x86::qword_ptr(x86::r10), 0);
c.xor_(x86::r11, 0xf80);
c.xor_(x86::r10, 0xf80);
#ifdef _WIN32
c.vmovups(x86::ymm4, x86::yword_ptr(args[3], 0));
c.vmovups(x86::ymm5, x86::yword_ptr(args[3], 96));
@ -298,8 +302,12 @@ const auto spu_getll_tx = build_function_asm<u64(*)(u32 raddr, void* rdata)>([](
// Touch memory after transaction failure
c.bind(fall);
c.pause();
c.xor_(x86::r11, 0xf80);
c.xor_(x86::r10, 0xf80);
c.mov(x86::rax, x86::qword_ptr(x86::r11));
c.mov(x86::rax, x86::qword_ptr(x86::r10));
c.xor_(x86::r11, 0xf80);
c.xor_(x86::r10, 0xf80);
c.sub(args[0], 1);
c.jnz(begin);
c.mov(x86::eax, 1);
@ -343,8 +351,12 @@ const auto spu_putlluc_tx = build_function_asm<bool(*)(u32 raddr, const void* rd
// Touch memory after transaction failure
c.bind(fall);
c.pause();
c.xor_(x86::r11, 0xf80);
c.xor_(x86::r10, 0xf80);
c.lock().add(x86::qword_ptr(x86::r11), 0);
c.lock().add(x86::qword_ptr(x86::r10), 0);
c.xor_(x86::r11, 0xf80);
c.xor_(x86::r10, 0xf80);
c.sub(args[0], 1);
c.jnz(begin);
c.xor_(x86::eax, x86::eax);