From: Jan Kiszka <[email protected]>

The case of mod=1 or 2 and rm = 4 (SIB) is easy to handle because we do
not need to evaluate the SIB byte and can simply skip over it.

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

diff --git a/hypervisor/arch/x86/mmio.c b/hypervisor/arch/x86/mmio.c
index b76b5356b..93f62f29e 100644
--- a/hypervisor/arch/x86/mmio.c
+++ b/hypervisor/arch/x86/mmio.c
@@ -171,9 +171,9 @@ restart:
                break;
        case 1:
        case 2:
-               if (op[2].modrm.rm == 4) /* SIB */
-                       goto error_unsupported;
                skip_len = op[2].modrm.mod == 1 ? 1 : 4;
+               if (op[2].modrm.rm == 4) /* SIB */
+                       skip_len++;
                break;
        default:
                goto error_unsupported;
@@ -187,7 +187,7 @@ restart:
                inst.in_reg_num = 15 - op[2].modrm.reg;
 
        if (has_immediate) {
-               /* walk any not yet retrieved displacement bytes */
+               /* walk any not yet retrieved SIB or displacement bytes */
                if (!ctx_update(&ctx, &pc, skip_len, pg_structs))
                        goto error_noinst;
 
-- 
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