xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86: fix emulation of indirect far calls and jumps
@ 2013-11-19 14:49 Jan Beulich
  2013-11-19 15:20 ` Keir Fraser
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Beulich @ 2013-11-19 14:49 UTC (permalink / raw)
  To: xen-devel; +Cc: anthony.perard, Keir Fraser

[-- Attachment #1: Type: text/plain, Size: 1550 bytes --]

Commit 86781624 ("x86_emulate: PUSH <mem> must read source operand
just once") corrected the operands of those of the operations of opcode
extension group 5 that only read memory from SrcMem to DstMem, but
failed to also switch the use of "dst" here to "src".

Reported-by: Anthony Perard <anthony.perard@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Tested-by: Anthony Perard <anthony.perard@citrix.com>

--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -3571,7 +3571,6 @@ x86_emulate(
             _regs.eip = src.val;
             src.val = dst.val;
             goto push;
-            break;
         case 4: /* jmp (near) */
             _regs.eip = src.val;
             dst.type = OP_NONE;
@@ -3580,9 +3579,9 @@ x86_emulate(
         case 5: /* jmp (far, absolute indirect) */ {
             unsigned long sel;
 
-            generate_exception_if(dst.type != OP_MEM, EXC_UD, -1);
+            generate_exception_if(src.type != OP_MEM, EXC_UD, -1);
 
-            if ( (rc = read_ulong(dst.mem.seg, dst.mem.off+dst.bytes,
+            if ( (rc = read_ulong(src.mem.seg, src.mem.off + op_bytes,
                                   &sel, 2, ctxt, ops)) )
                 goto done;
 
@@ -3600,7 +3599,7 @@ x86_emulate(
 
             if ( (rc = load_seg(x86_seg_cs, sel, ctxt, ops)) != 0 )
                 goto done;
-            _regs.eip = dst.val;
+            _regs.eip = src.val;
 
             dst.type = OP_NONE;
             break;




[-- Attachment #2: x86-emul-far-call.patch --]
[-- Type: text/plain, Size: 1598 bytes --]

x86: fix emulation of indirect far calls and jumps

Commit 86781624 ("x86_emulate: PUSH <mem> must read source operand
just once") corrected the operands of those of the operations of opcode
extension group 5 that only read memory from SrcMem to DstMem, but
failed to also switch the use of "dst" here to "src".

Reported-by: Anthony Perard <anthony.perard@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Tested-by: Anthony Perard <anthony.perard@citrix.com>

--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -3571,7 +3571,6 @@ x86_emulate(
             _regs.eip = src.val;
             src.val = dst.val;
             goto push;
-            break;
         case 4: /* jmp (near) */
             _regs.eip = src.val;
             dst.type = OP_NONE;
@@ -3580,9 +3579,9 @@ x86_emulate(
         case 5: /* jmp (far, absolute indirect) */ {
             unsigned long sel;
 
-            generate_exception_if(dst.type != OP_MEM, EXC_UD, -1);
+            generate_exception_if(src.type != OP_MEM, EXC_UD, -1);
 
-            if ( (rc = read_ulong(dst.mem.seg, dst.mem.off+dst.bytes,
+            if ( (rc = read_ulong(src.mem.seg, src.mem.off + op_bytes,
                                   &sel, 2, ctxt, ops)) )
                 goto done;
 
@@ -3600,7 +3599,7 @@ x86_emulate(
 
             if ( (rc = load_seg(x86_seg_cs, sel, ctxt, ops)) != 0 )
                 goto done;
-            _regs.eip = dst.val;
+            _regs.eip = src.val;
 
             dst.type = OP_NONE;
             break;

[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] x86: fix emulation of indirect far calls and jumps
  2013-11-19 14:49 [PATCH] x86: fix emulation of indirect far calls and jumps Jan Beulich
@ 2013-11-19 15:20 ` Keir Fraser
  0 siblings, 0 replies; 2+ messages in thread
From: Keir Fraser @ 2013-11-19 15:20 UTC (permalink / raw)
  To: Jan Beulich, xen-devel; +Cc: anthony.perard

On 19/11/2013 06:49, "Jan Beulich" <JBeulich@suse.com> wrote:

> Commit 86781624 ("x86_emulate: PUSH <mem> must read source operand
> just once") corrected the operands of those of the operations of opcode
> extension group 5 that only read memory from SrcMem to DstMem, but
> failed to also switch the use of "dst" here to "src".
> 
> Reported-by: Anthony Perard <anthony.perard@citrix.com>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> Tested-by: Anthony Perard <anthony.perard@citrix.com>

Acked-by: Keir Fraser <keir@xen.org>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-11-19 15:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-19 14:49 [PATCH] x86: fix emulation of indirect far calls and jumps Jan Beulich
2013-11-19 15:20 ` Keir Fraser

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).