diff options
| -rw-r--r-- | arch/x86/kvm/emulate.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 56628a44668b..f36d0fa6b885 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c | |||
| @@ -818,6 +818,20 @@ static int segmented_read_std(struct x86_emulate_ctxt *ctxt, | |||
| 818 | return ctxt->ops->read_std(ctxt, linear, data, size, &ctxt->exception); | 818 | return ctxt->ops->read_std(ctxt, linear, data, size, &ctxt->exception); |
| 819 | } | 819 | } |
| 820 | 820 | ||
| 821 | static int segmented_write_std(struct x86_emulate_ctxt *ctxt, | ||
| 822 | struct segmented_address addr, | ||
| 823 | void *data, | ||
| 824 | unsigned int size) | ||
| 825 | { | ||
| 826 | int rc; | ||
| 827 | ulong linear; | ||
| 828 | |||
| 829 | rc = linearize(ctxt, addr, size, true, &linear); | ||
| 830 | if (rc != X86EMUL_CONTINUE) | ||
| 831 | return rc; | ||
| 832 | return ctxt->ops->write_std(ctxt, linear, data, size, &ctxt->exception); | ||
| 833 | } | ||
| 834 | |||
| 821 | /* | 835 | /* |
| 822 | * Prefetch the remaining bytes of the instruction without crossing page | 836 | * Prefetch the remaining bytes of the instruction without crossing page |
| 823 | * boundary if they are not in fetch_cache yet. | 837 | * boundary if they are not in fetch_cache yet. |
| @@ -3685,8 +3699,8 @@ static int emulate_store_desc_ptr(struct x86_emulate_ctxt *ctxt, | |||
| 3685 | } | 3699 | } |
| 3686 | /* Disable writeback. */ | 3700 | /* Disable writeback. */ |
| 3687 | ctxt->dst.type = OP_NONE; | 3701 | ctxt->dst.type = OP_NONE; |
| 3688 | return segmented_write(ctxt, ctxt->dst.addr.mem, | 3702 | return segmented_write_std(ctxt, ctxt->dst.addr.mem, |
| 3689 | &desc_ptr, 2 + ctxt->op_bytes); | 3703 | &desc_ptr, 2 + ctxt->op_bytes); |
| 3690 | } | 3704 | } |
| 3691 | 3705 | ||
| 3692 | static int em_sgdt(struct x86_emulate_ctxt *ctxt) | 3706 | static int em_sgdt(struct x86_emulate_ctxt *ctxt) |
| @@ -3932,7 +3946,7 @@ static int em_fxsave(struct x86_emulate_ctxt *ctxt) | |||
| 3932 | else | 3946 | else |
| 3933 | size = offsetof(struct fxregs_state, xmm_space[0]); | 3947 | size = offsetof(struct fxregs_state, xmm_space[0]); |
| 3934 | 3948 | ||
| 3935 | return segmented_write(ctxt, ctxt->memop.addr.mem, &fx_state, size); | 3949 | return segmented_write_std(ctxt, ctxt->memop.addr.mem, &fx_state, size); |
| 3936 | } | 3950 | } |
| 3937 | 3951 | ||
| 3938 | static int fxrstor_fixup(struct x86_emulate_ctxt *ctxt, | 3952 | static int fxrstor_fixup(struct x86_emulate_ctxt *ctxt, |
| @@ -3974,7 +3988,7 @@ static int em_fxrstor(struct x86_emulate_ctxt *ctxt) | |||
| 3974 | if (rc != X86EMUL_CONTINUE) | 3988 | if (rc != X86EMUL_CONTINUE) |
| 3975 | return rc; | 3989 | return rc; |
| 3976 | 3990 | ||
| 3977 | rc = segmented_read(ctxt, ctxt->memop.addr.mem, &fx_state, 512); | 3991 | rc = segmented_read_std(ctxt, ctxt->memop.addr.mem, &fx_state, 512); |
| 3978 | if (rc != X86EMUL_CONTINUE) | 3992 | if (rc != X86EMUL_CONTINUE) |
| 3979 | return rc; | 3993 | return rc; |
| 3980 | 3994 | ||
