mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-04 08:16:47 +07:00
KVM: x86 emulator: emulate cpuid
Opcode 0F A2. Used by Linux during the mode change trampoline while in a state that is not virtualizable on vmx without unrestricted_guest, so we need to emulate it is emulate_invalid_guest_state=1. Signed-off-by: Avi Kivity <avi@redhat.com>
This commit is contained in:
parent
0017f93a27
commit
6d6eede4a0
@ -3142,6 +3142,20 @@ static int em_bsr(struct x86_emulate_ctxt *ctxt)
|
|||||||
return X86EMUL_CONTINUE;
|
return X86EMUL_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int em_cpuid(struct x86_emulate_ctxt *ctxt)
|
||||||
|
{
|
||||||
|
u32 eax, ebx, ecx, edx;
|
||||||
|
|
||||||
|
eax = ctxt->regs[VCPU_REGS_RAX];
|
||||||
|
ecx = ctxt->regs[VCPU_REGS_RCX];
|
||||||
|
ctxt->ops->get_cpuid(ctxt, &eax, &ebx, &ecx, &edx);
|
||||||
|
ctxt->regs[VCPU_REGS_RAX] = eax;
|
||||||
|
ctxt->regs[VCPU_REGS_RBX] = ebx;
|
||||||
|
ctxt->regs[VCPU_REGS_RCX] = ecx;
|
||||||
|
ctxt->regs[VCPU_REGS_RDX] = edx;
|
||||||
|
return X86EMUL_CONTINUE;
|
||||||
|
}
|
||||||
|
|
||||||
static bool valid_cr(int nr)
|
static bool valid_cr(int nr)
|
||||||
{
|
{
|
||||||
switch (nr) {
|
switch (nr) {
|
||||||
@ -3634,7 +3648,7 @@ static struct opcode twobyte_table[256] = {
|
|||||||
X16(D(ByteOp | DstMem | SrcNone | ModRM| Mov)),
|
X16(D(ByteOp | DstMem | SrcNone | ModRM| Mov)),
|
||||||
/* 0xA0 - 0xA7 */
|
/* 0xA0 - 0xA7 */
|
||||||
I(Stack | Src2FS, em_push_sreg), I(Stack | Src2FS, em_pop_sreg),
|
I(Stack | Src2FS, em_push_sreg), I(Stack | Src2FS, em_pop_sreg),
|
||||||
DI(ImplicitOps, cpuid), I(DstMem | SrcReg | ModRM | BitOp, em_bt),
|
II(ImplicitOps, em_cpuid, cpuid), I(DstMem | SrcReg | ModRM | BitOp, em_bt),
|
||||||
D(DstMem | SrcReg | Src2ImmByte | ModRM),
|
D(DstMem | SrcReg | Src2ImmByte | ModRM),
|
||||||
D(DstMem | SrcReg | Src2CL | ModRM), N, N,
|
D(DstMem | SrcReg | Src2CL | ModRM), N, N,
|
||||||
/* 0xA8 - 0xAF */
|
/* 0xA8 - 0xAF */
|
||||||
|
Loading…
Reference in New Issue
Block a user