From: Jan Kiszka <[email protected]>
The immediate value of mov imm,<mem> is still 32-bit in case of a 64-bit
write, but it has to be sign-extended in that case. Add the missing
logic.
Fixes: 95202a038b9e ("x86,mmio: Add support for 1 more instructions on
the MMIO dispatcher")
Signed-off-by: Jan Kiszka <[email protected]>
---
hypervisor/arch/x86/mmio.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/hypervisor/arch/x86/mmio.c b/hypervisor/arch/x86/mmio.c
index 8890fedb7..b76b5356b 100644
--- a/hypervisor/arch/x86/mmio.c
+++ b/hypervisor/arch/x86/mmio.c
@@ -197,6 +197,10 @@ restart:
goto error_noinst;
inst.out_val |= (unsigned long)*ctx.inst << (n * 8);
}
+
+ /* sign-extend immediate if the target is 64-bit */
+ if (has_rex_w)
+ inst.out_val = (s64)(s32)inst.out_val;
} else {
inst.inst_len += skip_len;
if (does_write)
--
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.