aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2010-11-22 10:53:24 -0500
committerAvi Kivity <avi@redhat.com>2011-01-12 04:29:56 -0500
commitdb297e3d8ed8409b969512c3ecd9d13223f2981c (patch)
treef45bb722f80e0ffd78a665c5f4dd1d69bda319e5
parent42438e364cbc1e95cacb4ca92688d54a50cf5c4d (diff)
KVM: x86 emulator: tighen up ->read_std() and ->write_std() error checks
Instead of checking for X86EMUL_PROPAGATE_FAULT, check for any error, making the callers more reliable. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
-rw-r--r--arch/x86/kvm/emulate.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 345aa4d3614a..223c536b7f71 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -1915,7 +1915,7 @@ static int task_switch_16(struct x86_emulate_ctxt *ctxt,
1915 1915
1916 ret = ops->read_std(old_tss_base, &tss_seg, sizeof tss_seg, ctxt->vcpu, 1916 ret = ops->read_std(old_tss_base, &tss_seg, sizeof tss_seg, ctxt->vcpu,
1917 &ctxt->exception); 1917 &ctxt->exception);
1918 if (ret == X86EMUL_PROPAGATE_FAULT) 1918 if (ret != X86EMUL_CONTINUE)
1919 /* FIXME: need to provide precise fault address */ 1919 /* FIXME: need to provide precise fault address */
1920 return ret; 1920 return ret;
1921 1921
@@ -1923,13 +1923,13 @@ static int task_switch_16(struct x86_emulate_ctxt *ctxt,
1923 1923
1924 ret = ops->write_std(old_tss_base, &tss_seg, sizeof tss_seg, ctxt->vcpu, 1924 ret = ops->write_std(old_tss_base, &tss_seg, sizeof tss_seg, ctxt->vcpu,
1925 &ctxt->exception); 1925 &ctxt->exception);
1926 if (ret == X86EMUL_PROPAGATE_FAULT) 1926 if (ret != X86EMUL_CONTINUE)
1927 /* FIXME: need to provide precise fault address */ 1927 /* FIXME: need to provide precise fault address */
1928 return ret; 1928 return ret;
1929 1929
1930 ret = ops->read_std(new_tss_base, &tss_seg, sizeof tss_seg, ctxt->vcpu, 1930 ret = ops->read_std(new_tss_base, &tss_seg, sizeof tss_seg, ctxt->vcpu,
1931 &ctxt->exception); 1931 &ctxt->exception);
1932 if (ret == X86EMUL_PROPAGATE_FAULT) 1932 if (ret != X86EMUL_CONTINUE)
1933 /* FIXME: need to provide precise fault address */ 1933 /* FIXME: need to provide precise fault address */
1934 return ret; 1934 return ret;
1935 1935
@@ -1940,7 +1940,7 @@ static int task_switch_16(struct x86_emulate_ctxt *ctxt,
1940 &tss_seg.prev_task_link, 1940 &tss_seg.prev_task_link,
1941 sizeof tss_seg.prev_task_link, 1941 sizeof tss_seg.prev_task_link,
1942 ctxt->vcpu, &ctxt->exception); 1942 ctxt->vcpu, &ctxt->exception);
1943 if (ret == X86EMUL_PROPAGATE_FAULT) 1943 if (ret != X86EMUL_CONTINUE)
1944 /* FIXME: need to provide precise fault address */ 1944 /* FIXME: need to provide precise fault address */
1945 return ret; 1945 return ret;
1946 } 1946 }
@@ -2049,7 +2049,7 @@ static int task_switch_32(struct x86_emulate_ctxt *ctxt,
2049 2049
2050 ret = ops->read_std(old_tss_base, &tss_seg, sizeof tss_seg, ctxt->vcpu, 2050 ret = ops->read_std(old_tss_base, &tss_seg, sizeof tss_seg, ctxt->vcpu,
2051 &ctxt->exception); 2051 &ctxt->exception);
2052 if (ret == X86EMUL_PROPAGATE_FAULT) 2052 if (ret != X86EMUL_CONTINUE)
2053 /* FIXME: need to provide precise fault address */ 2053 /* FIXME: need to provide precise fault address */
2054 return ret; 2054 return ret;
2055 2055
@@ -2057,13 +2057,13 @@ static int task_switch_32(struct x86_emulate_ctxt *ctxt,
2057 2057
2058 ret = ops->write_std(old_tss_base, &tss_seg, sizeof tss_seg, ctxt->vcpu, 2058 ret = ops->write_std(old_tss_base, &tss_seg, sizeof tss_seg, ctxt->vcpu,
2059 &ctxt->exception); 2059 &ctxt->exception);
2060 if (ret == X86EMUL_PROPAGATE_FAULT) 2060 if (ret != X86EMUL_CONTINUE)
2061 /* FIXME: need to provide precise fault address */ 2061 /* FIXME: need to provide precise fault address */
2062 return ret; 2062 return ret;
2063 2063
2064 ret = ops->read_std(new_tss_base, &tss_seg, sizeof tss_seg, ctxt->vcpu, 2064 ret = ops->read_std(new_tss_base, &tss_seg, sizeof tss_seg, ctxt->vcpu,
2065 &ctxt->exception); 2065 &ctxt->exception);
2066 if (ret == X86EMUL_PROPAGATE_FAULT) 2066 if (ret != X86EMUL_CONTINUE)
2067 /* FIXME: need to provide precise fault address */ 2067 /* FIXME: need to provide precise fault address */
2068 return ret; 2068 return ret;
2069 2069
@@ -2074,7 +2074,7 @@ static int task_switch_32(struct x86_emulate_ctxt *ctxt,
2074 &tss_seg.prev_task_link, 2074 &tss_seg.prev_task_link,
2075 sizeof tss_seg.prev_task_link, 2075 sizeof tss_seg.prev_task_link,
2076 ctxt->vcpu, &ctxt->exception); 2076 ctxt->vcpu, &ctxt->exception);
2077 if (ret == X86EMUL_PROPAGATE_FAULT) 2077 if (ret != X86EMUL_CONTINUE)
2078 /* FIXME: need to provide precise fault address */ 2078 /* FIXME: need to provide precise fault address */
2079 return ret; 2079 return ret;
2080 } 2080 }