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@suse.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
This commit is contained in:
Jan Beulich committed 2018-03-22 10:38:02 +01:00
1 parent abf5fb62f7
commit 3c78c287aa
7 files changed
+13 -5

No files matched your search

@@ -347,6 +347,7 @@ static int fuzz_cmpxchg(
void *old,
void *new,
unsigned int bytes,
bool lock,
struct x86_emulate_ctxt *ctxt)
{
/*
@@ -320,6 +320,7 @@ static int cmpxchg(
void *old,
void *new,
unsigned int bytes,
bool lock,
struct x86_emulate_ctxt *ctxt)
{
if ( verbose )
+2
View File
@@ -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. */
+1
View File
@@ -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 =
+1 -1
View File
@@ -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;
+4 -3
View File
@@ -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
{
+3 -1
View File
@@ -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);
/*
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.