mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-07-02 00:26:02 +02:00
e
This commit is contained in:
parent
6154679802
commit
e615845774
1 changed files with 12 additions and 1 deletions
|
|
@ -98,7 +98,18 @@ void EmitSpinLockLock(Xbyak::CodeGenerator& code, Xbyak::Address ptr, Xbyak::Reg
|
||||||
// ptr operand must be a dword[ptr]
|
// ptr operand must be a dword[ptr]
|
||||||
void EmitSpinLockUnlock(Xbyak::CodeGenerator& code, Xbyak::Address ptr, Xbyak::Reg32 tmp) {
|
void EmitSpinLockUnlock(Xbyak::CodeGenerator& code, Xbyak::Address ptr, Xbyak::Reg32 tmp) {
|
||||||
code.xor_(tmp, tmp);
|
code.xor_(tmp, tmp);
|
||||||
code.xchg(ptr, tmp);
|
if (ptr.is64bitDisp()) {
|
||||||
|
// if tmp is on eax, use ebx, otherwise use eax!
|
||||||
|
auto const other_tmp = tmp.cvt32() == Xbyak::util::eax
|
||||||
|
? Xbyak::util::rbx
|
||||||
|
: Xbyak::util::rax;
|
||||||
|
code.push(other_tmp);
|
||||||
|
code.mov(other_tmp, ptr.getDisp());
|
||||||
|
/*code.lock();*/ code.xchg(code.dword[other_tmp], tmp);
|
||||||
|
code.pop(other_tmp);
|
||||||
|
} else {
|
||||||
|
/*code.lock();*/ code.xchg(ptr, tmp);
|
||||||
|
}
|
||||||
code.mfence();
|
code.mfence();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue