| 5957 | } |
| 5958 | |
| 5959 | void JitArmV8CodeGen::dynamic_arith_value_lock(JitWidth width, DecodedOp* op, U32 value, LazyFlagType flagsType, std::function<void(RegPtr src, RegPtr dst, RegPtr address)> atomicCallback, std::function<void(RegPtr result, RegPtr dst, U32 src)> callback) { |
| 5960 | JitCodeGen::write(width, calculateEaa(op), nullptr, [value, atomicCallback, width, flagsType, op, callback, this](MemPtr mem) { |
| 5961 | RegPtr address = calculateAddress(mem); |
| 5962 | const LazyFlags* flags = lazyFlags[flagsType]; |
| 5963 | JitFlags flagData(this, cpu, op, flagsType, value, nullptr); |
| 5964 | |
| 5965 | RegPtr dst = getTmpReg(); |
| 5966 | RegPtr result = getTmpReg(); |
| 5967 | |
| 5968 | #ifdef BOXEDWINE_HOST_EXCEPTIONS |
| 5969 | if (rt.cpu_features().has(asmjit::CpuFeatures::ARM::kLSE)) { |
| 5970 | RegPtr reg = loadConst(value); |
| 5971 | atomicCallback(reg, dst, address); |
| 5972 | if (flags && flags->usesResult(flagData.needsToSetFlags)) { |
| 5973 | callback(result, dst, value); |
| 5974 | } |
| 5975 | } else |
| 5976 | #endif |
| 5977 | if (rt.cpu_features().has(asmjit::CpuFeatures::ARM::kLSE)) { |
| 5978 | Label label = compiler.new_label(); |
| 5979 | RegPtr cond = getTmpReg(); |
| 5980 | RegPtr prvMemSrc = getTmpReg(); |
| 5981 | |
| 5982 | readHost(width, createMemPtr(address, 0), dst, false); |
| 5983 | |
| 5984 | compiler.bind(label); |
| 5985 | |
| 5986 | compiler.mov(R32(prvMemSrc), R32(dst)); |
| 5987 | callback(result, dst, value); |
| 5988 | casal(width, R32(dst), R32(result), Mem(R64(address))); |
| 5989 | compiler.sub(R32(cond), R32(dst), R32(prvMemSrc)); |
| 5990 | compiler.cbnz(R32(cond), label); |
| 5991 | dst = prvMemSrc; |
| 5992 | } else { |
| 5993 | Label label = compiler.new_label(); |
| 5994 | RegPtr cond = getTmpReg(); |
| 5995 | |
| 5996 | compiler.bind(label); |
| 5997 | ldaxr(width, R32(dst), Mem(R64(address))); |
| 5998 | callback(result, dst, value); |
| 5999 | stlxr(width, R32(cond), R32(result), Mem(R64(address))); |
| 6000 | compiler.cbnz(R32(cond), label); |
| 6001 | } |
| 6002 | flagData.commit(result, dst); |
| 6003 | }); |
| 6004 | } |
| 6005 | void JitArmV8CodeGen::dynamic_xaddr32e32_lock(DecodedOp* op) { |
| 6006 | dynamic_arith_lock(JitWidth::b32, op, FLAGS_ADD32, [this](RegPtr src, RegPtr dst, RegPtr address) { |
| 6007 | compiler.ldaddal(R32(src), R32(dst), Mem(R64(address))); |
nothing calls this directly
no test coverage detected