aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/include/asm/kvm_emulate.h1
-rw-r--r--arch/x86/kvm/emulate.c10
2 files changed, 7 insertions, 4 deletions
diff --git a/arch/x86/include/asm/kvm_emulate.h b/arch/x86/include/asm/kvm_emulate.h
index 8762411fe9bb..cbdf76722d7d 100644
--- a/arch/x86/include/asm/kvm_emulate.h
+++ b/arch/x86/include/asm/kvm_emulate.h
@@ -198,6 +198,7 @@ struct decode_cache {
198 u8 modrm_mod; 198 u8 modrm_mod;
199 u8 modrm_reg; 199 u8 modrm_reg;
200 u8 modrm_rm; 200 u8 modrm_rm;
201 u8 modrm_seg;
201 u8 use_modrm_ea; 202 u8 use_modrm_ea;
202 bool rip_relative; 203 bool rip_relative;
203 unsigned long modrm_ea; 204 unsigned long modrm_ea;
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 760e2b030e68..471f12ae29cf 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -593,6 +593,7 @@ static int decode_modrm(struct x86_emulate_ctxt *ctxt,
593 c->modrm_rm |= (c->modrm & 0x07); 593 c->modrm_rm |= (c->modrm & 0x07);
594 c->modrm_ea = 0; 594 c->modrm_ea = 0;
595 c->use_modrm_ea = 1; 595 c->use_modrm_ea = 1;
596 c->modrm_seg = VCPU_SREG_DS;
596 597
597 if (c->modrm_mod == 3) { 598 if (c->modrm_mod == 3) {
598 c->modrm_ptr = decode_register(c->modrm_rm, 599 c->modrm_ptr = decode_register(c->modrm_rm,
@@ -649,8 +650,7 @@ static int decode_modrm(struct x86_emulate_ctxt *ctxt,
649 } 650 }
650 if (c->modrm_rm == 2 || c->modrm_rm == 3 || 651 if (c->modrm_rm == 2 || c->modrm_rm == 3 ||
651 (c->modrm_rm == 6 && c->modrm_mod != 0)) 652 (c->modrm_rm == 6 && c->modrm_mod != 0))
652 if (!c->has_seg_override) 653 c->modrm_seg = VCPU_SREG_SS;
653 set_seg_override(c, VCPU_SREG_SS);
654 c->modrm_ea = (u16)c->modrm_ea; 654 c->modrm_ea = (u16)c->modrm_ea;
655 } else { 655 } else {
656 /* 32/64-bit ModR/M decode. */ 656 /* 32/64-bit ModR/M decode. */
@@ -2405,9 +2405,11 @@ done_prefixes:
2405 c->op_bytes = 8; 2405 c->op_bytes = 8;
2406 2406
2407 /* ModRM and SIB bytes. */ 2407 /* ModRM and SIB bytes. */
2408 if (c->d & ModRM) 2408 if (c->d & ModRM) {
2409 rc = decode_modrm(ctxt, ops); 2409 rc = decode_modrm(ctxt, ops);
2410 else if (c->d & MemAbs) 2410 if (!c->has_seg_override)
2411 set_seg_override(c, c->modrm_seg);
2412 } else if (c->d & MemAbs)
2411 rc = decode_abs(ctxt, ops); 2413 rc = decode_abs(ctxt, ops);
2412 if (rc != X86EMUL_CONTINUE) 2414 if (rc != X86EMUL_CONTINUE)
2413 goto done; 2415 goto done;