[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v3 19/25] x86emul: tell cmpxchg hook whether LOCK is in effect
This is necessary for the hook to correctly perform the operation. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> --- v3: New. --- a/tools/fuzz/x86_instruction_emulator/fuzz-emul.c +++ b/tools/fuzz/x86_instruction_emulator/fuzz-emul.c @@ -346,6 +346,7 @@ static int fuzz_cmpxchg( void *old, void *new, unsigned int bytes, + bool lock, struct x86_emulate_ctxt *ctxt) { /* --- a/tools/tests/x86_emulator/test_x86_emulator.c +++ b/tools/tests/x86_emulator/test_x86_emulator.c @@ -320,6 +320,7 @@ static int cmpxchg( void *old, void *new, unsigned int bytes, + bool lock, struct x86_emulate_ctxt *ctxt) { if ( verbose ) --- a/xen/arch/x86/hvm/emulate.c +++ b/xen/arch/x86/hvm/emulate.c @@ -1249,6 +1249,7 @@ static int hvmemul_cmpxchg_discard( void *p_old, void *p_new, unsigned int bytes, + bool lock, struct x86_emulate_ctxt *ctxt) { return X86EMUL_OKAY; @@ -1292,6 +1293,7 @@ static int hvmemul_cmpxchg( void *p_old, void *p_new, unsigned int bytes, + bool lock, struct x86_emulate_ctxt *ctxt) { /* Fix this in case the guest is really relying on r-m-w atomicity. */ --- a/xen/arch/x86/mm/shadow/common.c +++ b/xen/arch/x86/mm/shadow/common.c @@ -281,6 +281,7 @@ hvm_emulate_cmpxchg(enum x86_segment seg void *p_old, void *p_new, unsigned int bytes, + bool lock, struct x86_emulate_ctxt *ctxt) { struct sh_emulate_ctxt *sh_ctxt = --- a/xen/arch/x86/pv/ro-page-fault.c +++ b/xen/arch/x86/pv/ro-page-fault.c @@ -216,7 +216,7 @@ static int ptwr_emulated_write(enum x86_ static int ptwr_emulated_cmpxchg(enum x86_segment seg, unsigned long offset, void *p_old, void *p_new, unsigned int bytes, - struct x86_emulate_ctxt *ctxt) + bool lock, struct x86_emulate_ctxt *ctxt) { paddr_t old = 0, new = 0; --- a/xen/arch/x86/x86_emulate/x86_emulate.c +++ b/xen/arch/x86/x86_emulate/x86_emulate.c @@ -1973,7 +1973,7 @@ protmode_load_seg( fail_if(!ops->cmpxchg); switch ( (rc = ops->cmpxchg(sel_seg, (sel & 0xfff8) + 4, &desc.b, - &new_desc_b, sizeof(desc.b), ctxt)) ) + &new_desc_b, sizeof(desc.b), true, ctxt)) ) { case X86EMUL_OKAY: break; @@ -6982,7 +6982,8 @@ x86_emulate( } if ( (rc = ops->cmpxchg(ea.mem.seg, ea.mem.off, old, aux, - op_bytes, ctxt)) != X86EMUL_OKAY ) + op_bytes, lock_prefix, + ctxt)) != X86EMUL_OKAY ) goto done; _regs.eflags |= X86_EFLAGS_ZF; } @@ -8434,7 +8435,7 @@ x86_emulate( fail_if(!ops->cmpxchg); rc = ops->cmpxchg( dst.mem.seg, dst.mem.off, &dst.orig_val, - &dst.val, dst.bytes, ctxt); + &dst.val, dst.bytes, true, ctxt); } else { --- a/xen/arch/x86/x86_emulate/x86_emulate.h +++ b/xen/arch/x86/x86_emulate/x86_emulate.h @@ -237,10 +237,11 @@ struct x86_emulate_ops struct x86_emulate_ctxt *ctxt); /* - * cmpxchg: Emulate an atomic (LOCKed) CMPXCHG operation. + * cmpxchg: Emulate a CMPXCHG operation. * @p_old: [IN ] Pointer to value expected to be current at @addr. * @p_new: [IN ] Pointer to value to write to @addr. * @bytes: [IN ] Operation size (up to 8 (x86/32) or 16 (x86/64) bytes). + * @lock: [IN ] atomic (LOCKed) operation */ int (*cmpxchg)( enum x86_segment seg, @@ -248,6 +249,7 @@ struct x86_emulate_ops void *p_old, void *p_new, unsigned int bytes, + bool lock, struct x86_emulate_ctxt *ctxt); /* _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |