[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] x86emul: tell cmpxchg hook whether LOCK is in effect
commit 3c78c287aacf897511a33cde27001b6bfabbf69f Author: Jan Beulich <jbeulich@xxxxxxxx> AuthorDate: Thu Mar 22 10:38:02 2018 +0100 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Thu Mar 22 10:38:02 2018 +0100 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> Reviewed-by: Paul Durrant <paul.durrant@xxxxxxxxxx> Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Acked-by: Tim Deegan <tim@xxxxxxx> --- tools/fuzz/x86_instruction_emulator/fuzz-emul.c | 1 + tools/tests/x86_emulator/test_x86_emulator.c | 1 + xen/arch/x86/hvm/emulate.c | 2 ++ xen/arch/x86/mm/shadow/common.c | 1 + xen/arch/x86/pv/ro-page-fault.c | 2 +- xen/arch/x86/x86_emulate/x86_emulate.c | 7 ++++--- xen/arch/x86/x86_emulate/x86_emulate.h | 4 +++- 7 files changed, 13 insertions(+), 5 deletions(-) diff --git a/tools/fuzz/x86_instruction_emulator/fuzz-emul.c b/tools/fuzz/x86_instruction_emulator/fuzz-emul.c index 36b3147de3..03a2473cdb 100644 --- a/tools/fuzz/x86_instruction_emulator/fuzz-emul.c +++ b/tools/fuzz/x86_instruction_emulator/fuzz-emul.c @@ -347,6 +347,7 @@ static int fuzz_cmpxchg( void *old, void *new, unsigned int bytes, + bool lock, struct x86_emulate_ctxt *ctxt) { /* diff --git a/tools/tests/x86_emulator/test_x86_emulator.c b/tools/tests/x86_emulator/test_x86_emulator.c index 05c15bcd8d..66f040fb11 100644 --- 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 ) diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c index 7bcc66c2e5..67f847f916 100644 --- a/xen/arch/x86/hvm/emulate.c +++ b/xen/arch/x86/hvm/emulate.c @@ -1250,6 +1250,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; @@ -1293,6 +1294,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. */ diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c index 1cf7b28735..e5f6763977 100644 --- 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 = diff --git a/xen/arch/x86/pv/ro-page-fault.c b/xen/arch/x86/pv/ro-page-fault.c index 12aab0a186..a550975f82 100644 --- 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_segment seg, unsigned long offset, 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) { intpte_t old = 0, new = 0; diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c index 008655c848..14fd64ff3d 100644 --- a/xen/arch/x86/x86_emulate/x86_emulate.c +++ b/xen/arch/x86/x86_emulate/x86_emulate.c @@ -1947,7 +1947,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; @@ -6941,7 +6941,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; } @@ -8392,7 +8393,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 { diff --git a/xen/arch/x86/x86_emulate/x86_emulate.h b/xen/arch/x86/x86_emulate/x86_emulate.h index 9749362e87..9cde44688a 100644 --- a/xen/arch/x86/x86_emulate/x86_emulate.h +++ b/xen/arch/x86/x86_emulate/x86_emulate.h @@ -245,10 +245,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, @@ -256,6 +257,7 @@ struct x86_emulate_ops void *p_old, void *p_new, unsigned int bytes, + bool lock, struct x86_emulate_ctxt *ctxt); /* -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |