diff options
author | Avi Kivity <avi@redhat.com> | 2011-09-13 03:45:50 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2011-09-25 12:52:57 -0400 |
commit | d4b4325fdb66739a74148f90da360ff82ce707d4 (patch) | |
tree | 1d16a1d5dfd3738346a9cebb7dca66f4ca583b27 | |
parent | c191a7a0f4d3b17cc6cee1d3f721dfe23fc7d6c6 (diff) |
KVM: x86 emulator: switch lds/les/lss/lfs/lgs to direct decode
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
-rw-r--r-- | arch/x86/kvm/emulate.c | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index ab48611b79cf..bd3e488c734e 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c | |||
@@ -1828,8 +1828,9 @@ static int em_ret_far(struct x86_emulate_ctxt *ctxt) | |||
1828 | return rc; | 1828 | return rc; |
1829 | } | 1829 | } |
1830 | 1830 | ||
1831 | static int emulate_load_segment(struct x86_emulate_ctxt *ctxt, int seg) | 1831 | static int em_lseg(struct x86_emulate_ctxt *ctxt) |
1832 | { | 1832 | { |
1833 | int seg = ctxt->src2.val; | ||
1833 | unsigned short sel; | 1834 | unsigned short sel; |
1834 | int rc; | 1835 | int rc; |
1835 | 1836 | ||
@@ -3193,8 +3194,8 @@ static struct opcode opcode_table[256] = { | |||
3193 | D2bv(DstMem | SrcImmByte | ModRM), | 3194 | D2bv(DstMem | SrcImmByte | ModRM), |
3194 | I(ImplicitOps | Stack | SrcImmU16, em_ret_near_imm), | 3195 | I(ImplicitOps | Stack | SrcImmU16, em_ret_near_imm), |
3195 | I(ImplicitOps | Stack, em_ret), | 3196 | I(ImplicitOps | Stack, em_ret), |
3196 | D(DstReg | SrcMemFAddr | ModRM | No64 | Src2ES), | 3197 | I(DstReg | SrcMemFAddr | ModRM | No64 | Src2ES, em_lseg), |
3197 | D(DstReg | SrcMemFAddr | ModRM | No64 | Src2DS), | 3198 | I(DstReg | SrcMemFAddr | ModRM | No64 | Src2DS, em_lseg), |
3198 | G(ByteOp, group11), G(0, group11), | 3199 | G(ByteOp, group11), G(0, group11), |
3199 | /* 0xC8 - 0xCF */ | 3200 | /* 0xC8 - 0xCF */ |
3200 | N, N, N, I(ImplicitOps | Stack, em_ret_far), | 3201 | N, N, N, I(ImplicitOps | Stack, em_ret_far), |
@@ -3281,10 +3282,10 @@ static struct opcode twobyte_table[256] = { | |||
3281 | D(ModRM), I(DstReg | SrcMem | ModRM, em_imul), | 3282 | D(ModRM), I(DstReg | SrcMem | ModRM, em_imul), |
3282 | /* 0xB0 - 0xB7 */ | 3283 | /* 0xB0 - 0xB7 */ |
3283 | D2bv(DstMem | SrcReg | ModRM | Lock), | 3284 | D2bv(DstMem | SrcReg | ModRM | Lock), |
3284 | D(DstReg | SrcMemFAddr | ModRM | Src2SS), | 3285 | I(DstReg | SrcMemFAddr | ModRM | Src2SS, em_lseg), |
3285 | D(DstMem | SrcReg | ModRM | BitOp | Lock), | 3286 | D(DstMem | SrcReg | ModRM | BitOp | Lock), |
3286 | D(DstReg | SrcMemFAddr | ModRM | Src2FS), | 3287 | I(DstReg | SrcMemFAddr | ModRM | Src2FS, em_lseg), |
3287 | D(DstReg | SrcMemFAddr | ModRM | Src2GS), | 3288 | I(DstReg | SrcMemFAddr | ModRM | Src2GS, em_lseg), |
3288 | D(ByteOp | DstReg | SrcMem | ModRM | Mov), D(DstReg | SrcMem16 | ModRM | Mov), | 3289 | D(ByteOp | DstReg | SrcMem | ModRM | Mov), D(DstReg | SrcMem16 | ModRM | Mov), |
3289 | /* 0xB8 - 0xBF */ | 3290 | /* 0xB8 - 0xBF */ |
3290 | N, N, | 3291 | N, N, |
@@ -3893,10 +3894,6 @@ special_insn: | |||
3893 | case 0xc0 ... 0xc1: | 3894 | case 0xc0 ... 0xc1: |
3894 | rc = em_grp2(ctxt); | 3895 | rc = em_grp2(ctxt); |
3895 | break; | 3896 | break; |
3896 | case 0xc4: /* les */ | ||
3897 | case 0xc5: /* lds */ | ||
3898 | rc = emulate_load_segment(ctxt, ctxt->src2.val); | ||
3899 | break; | ||
3900 | case 0xcc: /* int3 */ | 3897 | case 0xcc: /* int3 */ |
3901 | rc = emulate_int(ctxt, 3); | 3898 | rc = emulate_int(ctxt, 3); |
3902 | break; | 3899 | break; |
@@ -4146,11 +4143,6 @@ twobyte_insn: | |||
4146 | ctxt->dst.addr.reg = (unsigned long *)&ctxt->regs[VCPU_REGS_RAX]; | 4143 | ctxt->dst.addr.reg = (unsigned long *)&ctxt->regs[VCPU_REGS_RAX]; |
4147 | } | 4144 | } |
4148 | break; | 4145 | break; |
4149 | case 0xb2: /* lss */ | ||
4150 | case 0xb4: /* lfs */ | ||
4151 | case 0xb5: /* lgs */ | ||
4152 | rc = emulate_load_segment(ctxt, ctxt->src2.val); | ||
4153 | break; | ||
4154 | case 0xb3: | 4146 | case 0xb3: |
4155 | btr: /* btr */ | 4147 | btr: /* btr */ |
4156 | emulate_2op_SrcV_nobyte(ctxt, "btr"); | 4148 | emulate_2op_SrcV_nobyte(ctxt, "btr"); |