[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 2/4] x86emul: use (locally) consistent exit mechanisms



At least similar code should use similar exit mechanisms (return vs
goto).

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
RFC reason: There are many more paths where we could return directly,
            avoiding the _put_fpu() and put_stub(). Otoh arguably the
            two existing return-s around the changes below could also
            be changed to "goto done" to restore consistency.

Subsequently we may then want to consider to reduce the number of
"goto done" by checking rc right after at least the main switch()
statements.

--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -2112,7 +2112,7 @@ x86_emulate(
             op_bytes = 8;
         if ( (rc = ops->write(x86_seg_ss, sp_pre_dec(op_bytes),
                               &reg.sel, op_bytes, ctxt)) != 0 )
-            goto done;
+            return rc;
         break;
     }
 
@@ -2125,9 +2125,8 @@ 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 )
-            goto done;
-        if ( (rc = load_seg(src.val, dst.val, 0, NULL, ctxt, ops)) != 0 )
+                              &dst.val, op_bytes, ctxt, ops)) != 0 ||
+             (rc = load_seg(src.val, dst.val, 0, NULL, ctxt, ops)) != 0 )
             return rc;
         break;
 



Attachment: x86emul-consistently-bail.patch
Description: Text document

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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.