KVM: Fix emulate_sys[call, enter, exit]()'s fault handling
authorTakuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Thu, 18 Feb 2010 10:15:02 +0000 (12:15 +0200)
committerMarcelo Tosatti <mtosatti@redhat.com>
Mon, 1 Mar 2010 15:36:14 +0000 (12:36 -0300)
commite54cfa97a9ca9a544a7257b89b530b505ae1b892
tree7ff46cd0cb6da4bab3dcdd7a0099f300a8b0b52f
parentc697518a861e6c43b92b848895f9926580ee63c3
KVM: Fix emulate_sys[call, enter, exit]()'s fault handling

This patch fixes emulate_syscall(), emulate_sysenter() and
emulate_sysexit() to handle injected faults properly.

Even though original code injects faults in these functions,
we cannot handle these unless we use the different return
value from the UNHANDLEABLE case. So this patch use X86EMUL_*
codes instead of -1 and 0 and makes x86_emulate_insn() to
handle these propagated faults.

Be sure that, in x86_emulate_insn(), goto cannot_emulate and
goto done with rc equals X86EMUL_UNHANDLEABLE have same effect.

Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/kvm/emulate.c