|
|
@ -102,10 +102,10 @@ void AxxEmitX64::EmitMemoryRead(AxxEmitContext& ctx, IR::Inst* inst) { |
|
|
code.call(wrapped_fn); |
|
|
code.call(wrapped_fn); |
|
|
|
|
|
|
|
|
fastmem_patch_info.emplace( |
|
|
fastmem_patch_info.emplace( |
|
|
mcl::bit_cast<u64>(location), |
|
|
|
|
|
|
|
|
std::bit_cast<u64>(location), |
|
|
FastmemPatchInfo{ |
|
|
FastmemPatchInfo{ |
|
|
mcl::bit_cast<u64>(code.getCurr()), |
|
|
|
|
|
mcl::bit_cast<u64>(wrapped_fn), |
|
|
|
|
|
|
|
|
std::bit_cast<u64>(code.getCurr()), |
|
|
|
|
|
std::bit_cast<u64>(wrapped_fn), |
|
|
*fastmem_marker, |
|
|
*fastmem_marker, |
|
|
conf.recompile_on_fastmem_failure, |
|
|
conf.recompile_on_fastmem_failure, |
|
|
}); |
|
|
}); |
|
|
@ -189,10 +189,10 @@ void AxxEmitX64::EmitMemoryWrite(AxxEmitContext& ctx, IR::Inst* inst) { |
|
|
code.call(wrapped_fn); |
|
|
code.call(wrapped_fn); |
|
|
|
|
|
|
|
|
fastmem_patch_info.emplace( |
|
|
fastmem_patch_info.emplace( |
|
|
mcl::bit_cast<u64>(location), |
|
|
|
|
|
|
|
|
std::bit_cast<u64>(location), |
|
|
FastmemPatchInfo{ |
|
|
FastmemPatchInfo{ |
|
|
mcl::bit_cast<u64>(code.getCurr()), |
|
|
|
|
|
mcl::bit_cast<u64>(wrapped_fn), |
|
|
|
|
|
|
|
|
std::bit_cast<u64>(code.getCurr()), |
|
|
|
|
|
std::bit_cast<u64>(wrapped_fn), |
|
|
*fastmem_marker, |
|
|
*fastmem_marker, |
|
|
conf.recompile_on_fastmem_failure, |
|
|
conf.recompile_on_fastmem_failure, |
|
|
}); |
|
|
}); |
|
|
@ -349,7 +349,7 @@ void AxxEmitX64::EmitExclusiveReadMemoryInline(AxxEmitContext& ctx, IR::Inst* in |
|
|
EmitExclusiveLock(code, conf, tmp, tmp2.cvt32()); |
|
|
EmitExclusiveLock(code, conf, tmp, tmp2.cvt32()); |
|
|
|
|
|
|
|
|
code.mov(code.byte[code.ABI_JIT_PTR + offsetof(AxxJitState, exclusive_state)], u8(1)); |
|
|
code.mov(code.byte[code.ABI_JIT_PTR + offsetof(AxxJitState, exclusive_state)], u8(1)); |
|
|
code.mov(tmp, mcl::bit_cast<u64>(GetExclusiveMonitorAddressPointer(conf.global_monitor, conf.processor_id))); |
|
|
|
|
|
|
|
|
code.mov(tmp, std::bit_cast<u64>(GetExclusiveMonitorAddressPointer(conf.global_monitor, conf.processor_id))); |
|
|
code.mov(qword[tmp], vaddr); |
|
|
code.mov(qword[tmp], vaddr); |
|
|
|
|
|
|
|
|
const auto fastmem_marker = ShouldFastmem(ctx, inst); |
|
|
const auto fastmem_marker = ShouldFastmem(ctx, inst); |
|
|
@ -362,10 +362,10 @@ void AxxEmitX64::EmitExclusiveReadMemoryInline(AxxEmitContext& ctx, IR::Inst* in |
|
|
const auto location = EmitReadMemoryMov<bitsize>(code, value_idx, src_ptr, ordered); |
|
|
const auto location = EmitReadMemoryMov<bitsize>(code, value_idx, src_ptr, ordered); |
|
|
|
|
|
|
|
|
fastmem_patch_info.emplace( |
|
|
fastmem_patch_info.emplace( |
|
|
mcl::bit_cast<u64>(location), |
|
|
|
|
|
|
|
|
std::bit_cast<u64>(location), |
|
|
FastmemPatchInfo{ |
|
|
FastmemPatchInfo{ |
|
|
mcl::bit_cast<u64>(code.getCurr()), |
|
|
|
|
|
mcl::bit_cast<u64>(wrapped_fn), |
|
|
|
|
|
|
|
|
std::bit_cast<u64>(code.getCurr()), |
|
|
|
|
|
std::bit_cast<u64>(wrapped_fn), |
|
|
*fastmem_marker, |
|
|
*fastmem_marker, |
|
|
conf.recompile_on_exclusive_fastmem_failure, |
|
|
conf.recompile_on_exclusive_fastmem_failure, |
|
|
}); |
|
|
}); |
|
|
@ -383,7 +383,7 @@ void AxxEmitX64::EmitExclusiveReadMemoryInline(AxxEmitContext& ctx, IR::Inst* in |
|
|
code.call(wrapped_fn); |
|
|
code.call(wrapped_fn); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
code.mov(tmp, mcl::bit_cast<u64>(GetExclusiveMonitorValuePointer(conf.global_monitor, conf.processor_id))); |
|
|
|
|
|
|
|
|
code.mov(tmp, std::bit_cast<u64>(GetExclusiveMonitorValuePointer(conf.global_monitor, conf.processor_id))); |
|
|
EmitWriteMemoryMov<bitsize>(code, tmp, value_idx, false); |
|
|
EmitWriteMemoryMov<bitsize>(code, tmp, value_idx, false); |
|
|
|
|
|
|
|
|
EmitExclusiveUnlock(code, conf, tmp, tmp2.cvt32()); |
|
|
EmitExclusiveUnlock(code, conf, tmp, tmp2.cvt32()); |
|
|
@ -441,7 +441,7 @@ void AxxEmitX64::EmitExclusiveWriteMemoryInline(AxxEmitContext& ctx, IR::Inst* i |
|
|
EmitExclusiveTestAndClear(code, conf, vaddr, tmp, rax); |
|
|
EmitExclusiveTestAndClear(code, conf, vaddr, tmp, rax); |
|
|
|
|
|
|
|
|
code.mov(code.byte[code.ABI_JIT_PTR + offsetof(AxxJitState, exclusive_state)], u8(0)); |
|
|
code.mov(code.byte[code.ABI_JIT_PTR + offsetof(AxxJitState, exclusive_state)], u8(0)); |
|
|
code.mov(tmp, mcl::bit_cast<u64>(GetExclusiveMonitorValuePointer(conf.global_monitor, conf.processor_id))); |
|
|
|
|
|
|
|
|
code.mov(tmp, std::bit_cast<u64>(GetExclusiveMonitorValuePointer(conf.global_monitor, conf.processor_id))); |
|
|
|
|
|
|
|
|
if constexpr (bitsize == 128) { |
|
|
if constexpr (bitsize == 128) { |
|
|
code.mov(rax, qword[tmp + 0]); |
|
|
code.mov(rax, qword[tmp + 0]); |
|
|
@ -499,10 +499,10 @@ void AxxEmitX64::EmitExclusiveWriteMemoryInline(AxxEmitContext& ctx, IR::Inst* i |
|
|
code.call(wrapped_fn); |
|
|
code.call(wrapped_fn); |
|
|
|
|
|
|
|
|
fastmem_patch_info.emplace( |
|
|
fastmem_patch_info.emplace( |
|
|
mcl::bit_cast<u64>(location), |
|
|
|
|
|
|
|
|
std::bit_cast<u64>(location), |
|
|
FastmemPatchInfo{ |
|
|
FastmemPatchInfo{ |
|
|
mcl::bit_cast<u64>(code.getCurr()), |
|
|
|
|
|
mcl::bit_cast<u64>(wrapped_fn), |
|
|
|
|
|
|
|
|
std::bit_cast<u64>(code.getCurr()), |
|
|
|
|
|
std::bit_cast<u64>(wrapped_fn), |
|
|
*fastmem_marker, |
|
|
*fastmem_marker, |
|
|
conf.recompile_on_exclusive_fastmem_failure, |
|
|
conf.recompile_on_exclusive_fastmem_failure, |
|
|
}); |
|
|
}); |
|
|
|