[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Xen-devel] [PATCH v2] vvmx: replace vmreturn() by vmsucceed()	and vmfail*()
 
- To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
 
- From: Haozhong Zhang <haozhong.zhang@xxxxxxxxx>
 
- Date: Thu, 15 Dec 2016 20:32:03 +0800
 
- Cc: Kevin Tian <kevin.tian@xxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Jun Nakajima <jun.nakajima@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxx
 
- Delivery-date: Thu, 15 Dec 2016 12:32:33 +0000
 
- List-id: Xen developer discussion <xen-devel.lists.xen.org>
 
- Mail-followup-to: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxx, Jun Nakajima <jun.nakajima@xxxxxxxxx>, Kevin Tian <kevin.tian@xxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
 
 
 
On 12/15/16 12:18 +0000, Andrew Cooper wrote:
 
On 15/12/16 12:06, Haozhong Zhang wrote:
 
Replace vmreturn() by vmsucceed(), vmfail(), vmfail_valid() and
vmfail_invalid(), which are consistent to the pseudo code on Intel
SDM, and allow to return VM instruction error numbers to L1
hypervisor.
Signed-off-by: Haozhong Zhang <haozhong.zhang@xxxxxxxxx>
---
Changes in v2:
 * Fix the incorrect eflags in vmfail_invalid().
---
 xen/arch/x86/hvm/vmx/vvmx.c        | 107 +++++++++++++++++++++----------------
 xen/include/asm-x86/hvm/vmx/vmcs.h |  15 ++++--
 2 files changed, 74 insertions(+), 48 deletions(-)
diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c
index c4f19a0..361620d 100644
--- a/xen/arch/x86/hvm/vmx/vvmx.c
+++ b/xen/arch/x86/hvm/vmx/vvmx.c
@@ -479,28 +479,37 @@ gp_fault:
     return X86EMUL_EXCEPTION;
 }
-static void vmreturn(struct cpu_user_regs *regs, enum vmx_ops_result ops_res)
+#define VMSUCCEED_EFLAGS_MASK \
+    (X86_EFLAGS_CF | X86_EFLAGS_PF | X86_EFLAGS_AF | \
+     X86_EFLAGS_ZF | X86_EFLAGS_SF | X86_EFLAGS_OF)
 
Apologies to nitpick, but this these aren't vmx specific, and we have
had a similar patten in the x86 instruction emulator.
Would you mind incorporating:
andrewcoop@andrewcoop:/local/xen.git/xen$ git diff
diff --git a/xen/include/asm-x86/processor.h
b/xen/include/asm-x86/processor.h
index eae4af2..01fc446 100644
--- a/xen/include/asm-x86/processor.h
+++ b/xen/include/asm-x86/processor.h
@@ -53,6 +53,10 @@
#define X86_EFLAGS_VIP 0x00100000 /* Virtual Interrupt Pending */
#define X86_EFLAGS_ID  0x00200000 /* CPUID detection flag */
+#define X86_EFLAGS_ARITH_MASK                           \
+    ((X86_EFLAGS_CF | X86_EFLAGS_PF | X86_EFLAGS_AF |   \
+      X86_EFLAGS_ZF | X86_EFLAGS_SF | X86_EFLAGS_OF))
+
 
 
Sure. And any reason to use double parentheses?
Haozhong
 
/*
 * Intel CPU flags in CR0
 */
and using that?  If so, Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
~Andrew
 
 
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel
 
 
    
     |