summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2010-08-18 16:11:24 +0400
committerAvi Kivity <avi@redhat.com>2010-10-24 12:51:12 +0400
commitb250e605895d02cede78922d034f7825af72a8b5 (patch)
treef9a5a70a3aac61362cb39f5bd2725bd0d4c6b861 /arch
parent0ef753b8c323f5b8d75d7dc57ceef6b35982afdb (diff)
downloadlinux-b250e605895d02cede78922d034f7825af72a8b5.tar.xz
KVM: x86 emulator: add SrcImmU16 operand type
Used for RET NEAR instructions. Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kvm/emulate.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 313357793968..db80e28471da 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -72,6 +72,7 @@
#define SrcImmFAddr (0xb<<4) /* Source is immediate far address */
#define SrcMemFAddr (0xc<<4) /* Source is far address in memory */
#define SrcAcc (0xd<<4) /* Source Accumulator */
+#define SrcImmU16 (0xe<<4) /* Immediate operand, unsigned, 16 bits */
#define SrcMask (0xf<<4)
/* Generic ModRM decode. */
#define ModRM (1<<8)
@@ -2678,13 +2679,17 @@ done_prefixes:
srcmem_common:
c->src = memop;
break;
+ case SrcImmU16:
+ c->src.bytes = 2;
+ goto srcimm;
case SrcImm:
case SrcImmU:
- c->src.type = OP_IMM;
- c->src.addr.mem = c->eip;
c->src.bytes = (c->d & ByteOp) ? 1 : c->op_bytes;
if (c->src.bytes == 8)
c->src.bytes = 4;
+ srcimm:
+ c->src.type = OP_IMM;
+ c->src.addr.mem = c->eip;
/* NB. Immediates are sign-extended as necessary. */
switch (c->src.bytes) {
case 1:
@@ -2697,7 +2702,8 @@ done_prefixes:
c->src.val = insn_fetch(s32, 4, c->eip);
break;
}
- if ((c->d & SrcMask) == SrcImmU) {
+ if ((c->d & SrcMask) == SrcImmU
+ || (c->d & SrcMask) == SrcImmU16) {
switch (c->src.bytes) {
case 1:
c->src.val &= 0xff;