diff options
author | Avi Kivity <avi@redhat.com> | 2011-04-21 05:21:50 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2011-05-22 08:39:35 -0400 |
commit | 5ef39c71d8398115245a5974b488f8703ba3a6b0 (patch) | |
tree | a668bd0b429fcce29a19911f099316aaaed95e9c /arch/x86/kvm/emulate.c | |
parent | 68152d88122b24fad0f5910f74efcd19120a19a8 (diff) |
KVM: x86 emulator: Use opcode::execute for 0F 01 opcode
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/emulate.c')
-rw-r--r-- | arch/x86/kvm/emulate.c | 56 |
1 files changed, 13 insertions, 43 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 2132fab188b0..252f28348cfe 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c | |||
@@ -2625,18 +2625,13 @@ static int em_lgdt(struct x86_emulate_ctxt *ctxt) | |||
2625 | return X86EMUL_CONTINUE; | 2625 | return X86EMUL_CONTINUE; |
2626 | } | 2626 | } |
2627 | 2627 | ||
2628 | static int em_svm(struct x86_emulate_ctxt *ctxt) | 2628 | static int em_vmmcall(struct x86_emulate_ctxt *ctxt) |
2629 | { | 2629 | { |
2630 | struct decode_cache *c = &ctxt->decode; | 2630 | struct decode_cache *c = &ctxt->decode; |
2631 | int rc; | 2631 | int rc; |
2632 | 2632 | ||
2633 | switch (c->modrm_rm) { | 2633 | rc = ctxt->ops->fix_hypercall(ctxt); |
2634 | case 1: | 2634 | |
2635 | rc = ctxt->ops->fix_hypercall(ctxt); | ||
2636 | break; | ||
2637 | default: | ||
2638 | return X86EMUL_UNHANDLEABLE; | ||
2639 | } | ||
2640 | /* Disable writeback. */ | 2635 | /* Disable writeback. */ |
2641 | c->dst.type = OP_NONE; | 2636 | c->dst.type = OP_NONE; |
2642 | return rc; | 2637 | return rc; |
@@ -2909,7 +2904,7 @@ static struct opcode group7_rm1[] = { | |||
2909 | 2904 | ||
2910 | static struct opcode group7_rm3[] = { | 2905 | static struct opcode group7_rm3[] = { |
2911 | DIP(SrcNone | ModRM | Prot | Priv, vmrun, check_svme_pa), | 2906 | DIP(SrcNone | ModRM | Prot | Priv, vmrun, check_svme_pa), |
2912 | DI(SrcNone | ModRM | Prot | VendorSpecific, vmmcall), | 2907 | II(SrcNone | ModRM | Prot | VendorSpecific, em_vmmcall, vmmcall), |
2913 | DIP(SrcNone | ModRM | Prot | Priv, vmload, check_svme_pa), | 2908 | DIP(SrcNone | ModRM | Prot | Priv, vmload, check_svme_pa), |
2914 | DIP(SrcNone | ModRM | Prot | Priv, vmsave, check_svme_pa), | 2909 | DIP(SrcNone | ModRM | Prot | Priv, vmsave, check_svme_pa), |
2915 | DIP(SrcNone | ModRM | Prot | Priv, stgi, check_svme), | 2910 | DIP(SrcNone | ModRM | Prot | Priv, stgi, check_svme), |
@@ -2961,15 +2956,17 @@ static struct opcode group6[] = { | |||
2961 | static struct group_dual group7 = { { | 2956 | static struct group_dual group7 = { { |
2962 | DI(ModRM | Mov | DstMem | Priv, sgdt), | 2957 | DI(ModRM | Mov | DstMem | Priv, sgdt), |
2963 | DI(ModRM | Mov | DstMem | Priv, sidt), | 2958 | DI(ModRM | Mov | DstMem | Priv, sidt), |
2964 | DI(ModRM | SrcMem | Priv, lgdt), DI(ModRM | SrcMem | Priv, lidt), | 2959 | II(ModRM | SrcMem | Priv, em_lgdt, lgdt), |
2965 | DI(SrcNone | ModRM | DstMem | Mov, smsw), N, | 2960 | II(ModRM | SrcMem | Priv, em_lidt, lidt), |
2966 | DI(SrcMem16 | ModRM | Mov | Priv, lmsw), | 2961 | II(SrcNone | ModRM | DstMem | Mov, em_smsw, smsw), N, |
2967 | DI(SrcMem | ModRM | ByteOp | Priv | NoAccess, invlpg), | 2962 | II(SrcMem16 | ModRM | Mov | Priv, em_lmsw, lmsw), |
2963 | II(SrcMem | ModRM | ByteOp | Priv | NoAccess, em_invlpg, invlpg), | ||
2968 | }, { | 2964 | }, { |
2969 | D(SrcNone | ModRM | Priv | VendorSpecific), EXT(0, group7_rm1), | 2965 | I(SrcNone | ModRM | Priv | VendorSpecific, em_vmcall), |
2966 | EXT(0, group7_rm1), | ||
2970 | N, EXT(0, group7_rm3), | 2967 | N, EXT(0, group7_rm3), |
2971 | DI(SrcNone | ModRM | DstMem | Mov, smsw), N, | 2968 | II(SrcNone | ModRM | DstMem | Mov, em_smsw, smsw), N, |
2972 | DI(SrcMem16 | ModRM | Mov | Priv, lmsw), EXT(0, group7_rm7), | 2969 | II(SrcMem16 | ModRM | Mov | Priv, em_lmsw, lmsw), EXT(0, group7_rm7), |
2973 | } }; | 2970 | } }; |
2974 | 2971 | ||
2975 | static struct opcode group8[] = { | 2972 | static struct opcode group8[] = { |
@@ -4107,33 +4104,6 @@ done: | |||
4107 | 4104 | ||
4108 | twobyte_insn: | 4105 | twobyte_insn: |
4109 | switch (c->b) { | 4106 | switch (c->b) { |
4110 | case 0x01: /* lgdt, lidt, lmsw */ | ||
4111 | switch (c->modrm_reg) { | ||
4112 | case 0: /* vmcall */ | ||
4113 | rc = em_vmcall(ctxt); | ||
4114 | break; | ||
4115 | case 2: /* lgdt */ | ||
4116 | rc = em_lgdt(ctxt); | ||
4117 | break; | ||
4118 | case 3: /* lidt/vmmcall */ | ||
4119 | if (c->modrm_mod == 3) | ||
4120 | return em_svm(ctxt); | ||
4121 | else | ||
4122 | return em_lidt(ctxt); | ||
4123 | break; | ||
4124 | case 4: /* smsw */ | ||
4125 | rc = em_smsw(ctxt); | ||
4126 | break; | ||
4127 | case 6: /* lmsw */ | ||
4128 | rc = em_lmsw(ctxt); | ||
4129 | break; | ||
4130 | case 7: /* invlpg*/ | ||
4131 | rc = em_invlpg(ctxt); | ||
4132 | break; | ||
4133 | default: | ||
4134 | goto cannot_emulate; | ||
4135 | } | ||
4136 | break; | ||
4137 | case 0x05: /* syscall */ | 4107 | case 0x05: /* syscall */ |
4138 | rc = emulate_syscall(ctxt, ops); | 4108 | rc = emulate_syscall(ctxt, ops); |
4139 | break; | 4109 | break; |