From: "Jan Beulich" <JBeulich@suse.com>
To: xen-devel <xen-devel@lists.xenproject.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Subject: [PATCH v2 1/3] use consistent exit mechanism
Date: Mon, 04 Jul 2016 05:55:08 -0600 [thread overview]
Message-ID: <577A6ABC02000078000FAD04@prv-mh.provo.novell.com> (raw)
In-Reply-To: <577A69E502000078000FACED@prv-mh.provo.novell.com>
[-- Attachment #1: Type: text/plain, Size: 1379 bytes --]
Similar code should use similar exit mechanisms (return vs goto).
Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
v2: Use "goto" instead of "return", making things consistent right away
instead of only after a (series of) future patch(es) converting
more code to "return".
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -2106,7 +2106,7 @@ x86_emulate(
generate_exception_if(mode_64bit() && !ext, EXC_UD, -1);
fail_if(ops->read_segment == NULL);
if ( (rc = ops->read_segment(src.val, ®, ctxt)) != 0 )
- return rc;
+ goto done;
/* 64-bit mode: PUSH defaults to a 64-bit operand. */
if ( mode_64bit() && (op_bytes == 4) )
op_bytes = 8;
@@ -2125,10 +2125,9 @@ x86_emulate(
if ( mode_64bit() && (op_bytes == 4) )
op_bytes = 8;
if ( (rc = read_ulong(x86_seg_ss, sp_post_inc(op_bytes),
- &dst.val, op_bytes, ctxt, ops)) != 0 )
+ &dst.val, op_bytes, ctxt, ops)) != 0 ||
+ (rc = load_seg(src.val, dst.val, 0, NULL, ctxt, ops)) != 0 )
goto done;
- if ( (rc = load_seg(src.val, dst.val, 0, NULL, ctxt, ops)) != 0 )
- return rc;
break;
case 0x0e: /* push %%cs */
[-- Attachment #2: x86emul-consistently-bail.patch --]
[-- Type: text/plain, Size: 1415 bytes --]
x86emul: use consistent exit mechanism
Similar code should use similar exit mechanisms (return vs goto).
Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
v2: Use "goto" instead of "return", making things consistent right away
instead of only after a (series of) future patch(es) converting
more code to "return".
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -2106,7 +2106,7 @@ x86_emulate(
generate_exception_if(mode_64bit() && !ext, EXC_UD, -1);
fail_if(ops->read_segment == NULL);
if ( (rc = ops->read_segment(src.val, ®, ctxt)) != 0 )
- return rc;
+ goto done;
/* 64-bit mode: PUSH defaults to a 64-bit operand. */
if ( mode_64bit() && (op_bytes == 4) )
op_bytes = 8;
@@ -2125,10 +2125,9 @@ x86_emulate(
if ( mode_64bit() && (op_bytes == 4) )
op_bytes = 8;
if ( (rc = read_ulong(x86_seg_ss, sp_post_inc(op_bytes),
- &dst.val, op_bytes, ctxt, ops)) != 0 )
+ &dst.val, op_bytes, ctxt, ops)) != 0 ||
+ (rc = load_seg(src.val, dst.val, 0, NULL, ctxt, ops)) != 0 )
goto done;
- if ( (rc = load_seg(src.val, dst.val, 0, NULL, ctxt, ops)) != 0 )
- return rc;
break;
case 0x0e: /* push %%cs */
[-- Attachment #3: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-07-04 11:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-04 11:51 [PATCH v2 0/3] x86: instruction emulator adjustments Jan Beulich
2016-07-04 11:55 ` Jan Beulich [this message]
2016-07-04 12:54 ` [PATCH v2 1/3] use consistent exit mechanism Andrew Cooper
2016-07-04 11:55 ` [PATCH v2 2/3] drop pointless and add useful default cases Jan Beulich
2016-07-04 12:55 ` Andrew Cooper
2016-07-04 11:56 ` [PATCH v2 3/3] x86emul: fold local variables Jan Beulich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=577A6ABC02000078000FAD04@prv-mh.provo.novell.com \
--to=jbeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.