Skip to content

Commit aca7f96

Browse files
Anthony Liguoriavikivity
authored andcommitted
KVM: x86 emulator: Add vmmcall/vmcall to x86_emulate (v3)
Add vmmcall/vmcall to x86_emulate. Future patch will implement functionality for these instructions. Signed-off-by: Anthony Liguori <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
1 parent dd430ca commit aca7f96

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

drivers/kvm/x86_emulate.c

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1380,19 +1380,30 @@ x86_emulate_memop(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops)
13801380
u16 size;
13811381
unsigned long address;
13821382

1383+
case 0: /* vmcall */
1384+
if (modrm_mod != 3 || modrm_rm != 1)
1385+
goto cannot_emulate;
1386+
1387+
/* nop */
1388+
break;
13831389
case 2: /* lgdt */
13841390
rc = read_descriptor(ctxt, ops, src.ptr,
13851391
&size, &address, op_bytes);
13861392
if (rc)
13871393
goto done;
13881394
realmode_lgdt(ctxt->vcpu, size, address);
13891395
break;
1390-
case 3: /* lidt */
1391-
rc = read_descriptor(ctxt, ops, src.ptr,
1392-
&size, &address, op_bytes);
1393-
if (rc)
1394-
goto done;
1395-
realmode_lidt(ctxt->vcpu, size, address);
1396+
case 3: /* lidt/vmmcall */
1397+
if (modrm_mod == 3 && modrm_rm == 1) {
1398+
/* nop */
1399+
} else {
1400+
rc = read_descriptor(ctxt, ops, src.ptr,
1401+
&size, &address,
1402+
op_bytes);
1403+
if (rc)
1404+
goto done;
1405+
realmode_lidt(ctxt->vcpu, size, address);
1406+
}
13961407
break;
13971408
case 4: /* smsw */
13981409
if (modrm_mod != 3)

0 commit comments

Comments
 (0)