aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/kvm/emulate.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 8e517bba6a7c..55322a7c113d 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -2996,6 +2996,28 @@ static int em_das(struct x86_emulate_ctxt *ctxt)
2996 return X86EMUL_CONTINUE; 2996 return X86EMUL_CONTINUE;
2997} 2997}
2998 2998
2999static int em_aam(struct x86_emulate_ctxt *ctxt)
3000{
3001 u8 al, ah;
3002
3003 if (ctxt->src.val == 0)
3004 return emulate_de(ctxt);
3005
3006 al = ctxt->dst.val & 0xff;
3007 ah = al / ctxt->src.val;
3008 al %= ctxt->src.val;
3009
3010 ctxt->dst.val = (ctxt->dst.val & 0xffff0000) | al | (ah << 8);
3011
3012 /* Set PF, ZF, SF */
3013 ctxt->src.type = OP_IMM;
3014 ctxt->src.val = 0;
3015 ctxt->src.bytes = 1;
3016 fastop(ctxt, em_or);
3017
3018 return X86EMUL_CONTINUE;
3019}
3020
2999static int em_aad(struct x86_emulate_ctxt *ctxt) 3021static int em_aad(struct x86_emulate_ctxt *ctxt)
3000{ 3022{
3001 u8 al = ctxt->dst.val & 0xff; 3023 u8 al = ctxt->dst.val & 0xff;
@@ -3936,7 +3958,8 @@ static const struct opcode opcode_table[256] = {
3936 /* 0xD0 - 0xD7 */ 3958 /* 0xD0 - 0xD7 */
3937 G(Src2One | ByteOp, group2), G(Src2One, group2), 3959 G(Src2One | ByteOp, group2), G(Src2One, group2),
3938 G(Src2CL | ByteOp, group2), G(Src2CL, group2), 3960 G(Src2CL | ByteOp, group2), G(Src2CL, group2),
3939 N, I(DstAcc | SrcImmByte | No64, em_aad), N, N, 3961 I(DstAcc | SrcImmUByte | No64, em_aam),
3962 I(DstAcc | SrcImmUByte | No64, em_aad), N, N,
3940 /* 0xD8 - 0xDF */ 3963 /* 0xD8 - 0xDF */
3941 N, E(0, &escape_d9), N, E(0, &escape_db), N, E(0, &escape_dd), N, N, 3964 N, E(0, &escape_d9), N, E(0, &escape_db), N, E(0, &escape_dd), N, N,
3942 /* 0xE0 - 0xE7 */ 3965 /* 0xE0 - 0xE7 */