From: Jan Kiszka <[email protected]>

This just improves readability and makes the code more compact. The
rm cases are now dispatched in ascending order.

Signed-off-by: Jan Kiszka <[email protected]>
---
 hypervisor/arch/x86/mmio.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/hypervisor/arch/x86/mmio.c b/hypervisor/arch/x86/mmio.c
index 93f62f29e..d4589d60d 100644
--- a/hypervisor/arch/x86/mmio.c
+++ b/hypervisor/arch/x86/mmio.c
@@ -155,19 +155,16 @@ restart:
 
        switch (op[2].modrm.mod) {
        case 0:
-               if (op[2].modrm.rm == 5) { /* 32-bit displacement */
-                       skip_len = 4;
-                       break;
-               } else if (op[2].modrm.rm != 4) { /* no SIB */
-                       break;
-               }
-
-               if (!ctx_update(&ctx, &pc, 1, pg_structs))
-                       goto error_noinst;
+               if (op[2].modrm.rm == 4) { /* SIB */
+                       if (!ctx_update(&ctx, &pc, 1, pg_structs))
+                               goto error_noinst;
 
-               op[3].raw = *ctx.inst;
-               if (op[3].sib.base == 5)
+                       op[3].raw = *ctx.inst;
+                       if (op[3].sib.base == 5)
+                               skip_len = 4;
+               } else if (op[2].modrm.rm == 5) { /* 32-bit displacement */
                        skip_len = 4;
+               }
                break;
        case 1:
        case 2:
-- 
2.13.6

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to