aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/kvm/x86_emulate.c
diff options
context:
space:
mode:
authorNitin A Kamble <nitin.a.kamble@intel.com>2007-08-17 08:17:41 -0400
committerAvi Kivity <avi@qumranet.com>2007-10-13 04:18:23 -0400
commit19eb938e0115693414a83b6bde2b67896bd9953a (patch)
tree16174b87dc16d32d0efe19162acba0db9ee6e190 /drivers/kvm/x86_emulate.c
parent253abdee5ec2edd0a7f6dc2358bef42e3fdf1f39 (diff)
KVM: x86 emulator: implement 'and $imm, %{al|ax|eax}'
Implement emulation of instruction and al imm8 (opcode 0x24) and ax/eax imm16/imm32 (opcode 0x25) Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/x86_emulate.c')
-rw-r--r--drivers/kvm/x86_emulate.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/drivers/kvm/x86_emulate.c b/drivers/kvm/x86_emulate.c
index b4f439cfc66e..2b94d16e9d23 100644
--- a/drivers/kvm/x86_emulate.c
+++ b/drivers/kvm/x86_emulate.c
@@ -83,7 +83,7 @@ static u8 opcode_table[256] = {
83 /* 0x20 - 0x27 */ 83 /* 0x20 - 0x27 */
84 ByteOp | DstMem | SrcReg | ModRM, DstMem | SrcReg | ModRM, 84 ByteOp | DstMem | SrcReg | ModRM, DstMem | SrcReg | ModRM,
85 ByteOp | DstReg | SrcMem | ModRM, DstReg | SrcMem | ModRM, 85 ByteOp | DstReg | SrcMem | ModRM, DstReg | SrcMem | ModRM,
86 0, 0, 0, 0, 86 SrcImmByte, SrcImm, 0, 0,
87 /* 0x28 - 0x2F */ 87 /* 0x28 - 0x2F */
88 ByteOp | DstMem | SrcReg | ModRM, DstMem | SrcReg | ModRM, 88 ByteOp | DstMem | SrcReg | ModRM, DstMem | SrcReg | ModRM,
89 ByteOp | DstReg | SrcMem | ModRM, DstReg | SrcMem | ModRM, 89 ByteOp | DstReg | SrcMem | ModRM, DstReg | SrcMem | ModRM,
@@ -882,10 +882,27 @@ done_prefixes:
882 sbb: /* sbb */ 882 sbb: /* sbb */
883 emulate_2op_SrcV("sbb", src, dst, _eflags); 883 emulate_2op_SrcV("sbb", src, dst, _eflags);
884 break; 884 break;
885 case 0x20 ... 0x25: 885 case 0x20 ... 0x23:
886 and: /* and */ 886 and: /* and */
887 emulate_2op_SrcV("and", src, dst, _eflags); 887 emulate_2op_SrcV("and", src, dst, _eflags);
888 break; 888 break;
889 case 0x24: /* and al imm8 */
890 dst.type = OP_REG;
891 dst.ptr = &_regs[VCPU_REGS_RAX];
892 dst.val = *(u8 *)dst.ptr;
893 dst.bytes = 1;
894 dst.orig_val = dst.val;
895 goto and;
896 case 0x25: /* and ax imm16, or eax imm32 */
897 dst.type = OP_REG;
898 dst.bytes = op_bytes;
899 dst.ptr = &_regs[VCPU_REGS_RAX];
900 if (op_bytes == 2)
901 dst.val = *(u16 *)dst.ptr;
902 else
903 dst.val = *(u32 *)dst.ptr;
904 dst.orig_val = dst.val;
905 goto and;
889 case 0x28 ... 0x2d: 906 case 0x28 ... 0x2d:
890 sub: /* sub */ 907 sub: /* sub */
891 emulate_2op_SrcV("sub", src, dst, _eflags); 908 emulate_2op_SrcV("sub", src, dst, _eflags);