aboutsummaryrefslogtreecommitdiffstats
path: root/xen/arch/x86/x86_emulate
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2012-11-08 10:52:32 +0100
committerJan Beulich <jbeulich@suse.com>2012-11-08 10:52:32 +0100
commit21a80b2bf97a76d0932b45a35af918b3409e77c1 (patch)
tree7c8d0b21125c4efb6897aadc7acd9e1a66e04468 /xen/arch/x86/x86_emulate
parent7a8f6d0607a38c64506b4e8b473d955bf8e2a71f (diff)
downloadxen-21a80b2bf97a76d0932b45a35af918b3409e77c1.tar.gz
xen-21a80b2bf97a76d0932b45a35af918b3409e77c1.tar.bz2
xen-21a80b2bf97a76d0932b45a35af918b3409e77c1.zip
x86/emul: only emulate possibly operand sizes for POPA
This opcode neither supports 1-byte operands, nor does it support 8-byte ones (since the opcode is undefined in 64-bit mode). Simplify the code accordingly. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen/arch/x86/x86_emulate')
-rw-r--r--xen/arch/x86/x86_emulate/x86_emulate.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index f0ee4891f8..462d7c72fd 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -1996,13 +1996,10 @@ x86_emulate(
if ( (rc = read_ulong(x86_seg_ss, sp_post_inc(op_bytes),
&dst.val, op_bytes, ctxt, ops)) != 0 )
goto done;
- switch ( op_bytes )
- {
- case 1: *(uint8_t *)regs[i] = (uint8_t)dst.val; break;
- case 2: *(uint16_t *)regs[i] = (uint16_t)dst.val; break;
- case 4: *regs[i] = (uint32_t)dst.val; break; /* 64b: zero-ext */
- case 8: *regs[i] = dst.val; break;
- }
+ if ( op_bytes == 2 )
+ *(uint16_t *)regs[i] = (uint16_t)dst.val;
+ else
+ *regs[i] = dst.val; /* 64b: zero-ext done by read_ulong() */
}
break;
}