forward branch for double-clear condition in reserved store
This commit is contained in:
@@ -864,6 +864,7 @@ void* X64HelperEmitter::EmitGuestAndHostSynchronizeStackSizeLoadThunk(
|
|||||||
code_offsets.tail = getSize();
|
code_offsets.tail = getSize();
|
||||||
return EmitCurrentForOffsets(code_offsets);
|
return EmitCurrentForOffsets(code_offsets);
|
||||||
}
|
}
|
||||||
|
|
||||||
void* X64HelperEmitter::EmitTryAcquireReservationHelper() {
|
void* X64HelperEmitter::EmitTryAcquireReservationHelper() {
|
||||||
_code_offsets code_offsets = {};
|
_code_offsets code_offsets = {};
|
||||||
code_offsets.prolog = getSize();
|
code_offsets.prolog = getSize();
|
||||||
@@ -884,7 +885,6 @@ void* X64HelperEmitter::EmitTryAcquireReservationHelper() {
|
|||||||
|
|
||||||
lock();
|
lock();
|
||||||
bts(qword[rdx], rcx);
|
bts(qword[rdx], rcx);
|
||||||
// DebugBreak();
|
|
||||||
// set flag on local backend context for thread to indicate our previous
|
// set flag on local backend context for thread to indicate our previous
|
||||||
// attempt to get the reservation succeeded
|
// attempt to get the reservation succeeded
|
||||||
setnc(r9b); // success = bitmap did not have a set bit at the idx
|
setnc(r9b); // success = bitmap did not have a set bit at the idx
|
||||||
@@ -914,13 +914,13 @@ void* X64HelperEmitter::EmitReservedStoreHelper(bool bit64) {
|
|||||||
code_offsets.prolog = getSize();
|
code_offsets.prolog = getSize();
|
||||||
Xbyak::Label done;
|
Xbyak::Label done;
|
||||||
Xbyak::Label reservation_isnt_for_our_addr;
|
Xbyak::Label reservation_isnt_for_our_addr;
|
||||||
|
Xbyak::Label somehow_double_cleared;
|
||||||
// carry must be set + zero flag must be set
|
// carry must be set + zero flag must be set
|
||||||
|
|
||||||
btr(GetBackendFlagsPtr(), 1);
|
btr(GetBackendFlagsPtr(), 1);
|
||||||
|
|
||||||
jnc(done);
|
jnc(done);
|
||||||
|
|
||||||
// mov(edx, i.src1.reg().cvt32());
|
|
||||||
mov(rax, GetBackendCtxPtr(offsetof(X64BackendContext, reserve_helper_)));
|
mov(rax, GetBackendCtxPtr(offsetof(X64BackendContext, reserve_helper_)));
|
||||||
|
|
||||||
shr(ecx, RESERVE_BLOCK_SHIFT);
|
shr(ecx, RESERVE_BLOCK_SHIFT);
|
||||||
@@ -958,22 +958,24 @@ void* X64HelperEmitter::EmitReservedStoreHelper(bool bit64) {
|
|||||||
lock();
|
lock();
|
||||||
btr(qword[rdx], rcx);
|
btr(qword[rdx], rcx);
|
||||||
|
|
||||||
// Xbyak::Label check_fucky;
|
jnc(somehow_double_cleared);
|
||||||
jc(done);
|
|
||||||
DebugBreak();
|
|
||||||
|
|
||||||
// L(check_fucky);
|
|
||||||
|
|
||||||
L(done);
|
L(done);
|
||||||
|
|
||||||
// i don't care that theres a dependency on the prev value of rax atm
|
// i don't care that theres a dependency on the prev value of rax atm
|
||||||
// sadly theres no CF&ZF condition code
|
// sadly theres no CF&ZF condition code
|
||||||
setz(al);
|
setz(al);
|
||||||
setc(ah);
|
setc(ah);
|
||||||
cmp(ax, 0x0101);
|
cmp(ax, 0x0101);
|
||||||
ret();
|
ret();
|
||||||
|
|
||||||
|
// could be the same label, but otherwise we don't know where we came from
|
||||||
|
// when one gets triggered
|
||||||
L(reservation_isnt_for_our_addr);
|
L(reservation_isnt_for_our_addr);
|
||||||
DebugBreak();
|
DebugBreak();
|
||||||
|
|
||||||
|
L(somehow_double_cleared); // somehow, something else cleared our reserve??
|
||||||
|
DebugBreak();
|
||||||
|
|
||||||
code_offsets.prolog_stack_alloc = getSize();
|
code_offsets.prolog_stack_alloc = getSize();
|
||||||
code_offsets.body = getSize();
|
code_offsets.body = getSize();
|
||||||
code_offsets.epilog = getSize();
|
code_offsets.epilog = getSize();
|
||||||
|
|||||||
Reference in New Issue
Block a user