Re: [Xen-devel] [PATCH] x86/vvmx: Drop sreg_to_index[]

2017-01-04 Thread Tian, Kevin
> From: Andrew Cooper [mailto:andrew.coop...@citrix.com]
> Sent: Tuesday, January 03, 2017 7:59 PM
> 
> Since c/s 0888d36b "x86/emul: Correct the decoding of SReg3 operands",
> x86_seg_* have followed hardware encodings, meaning that this translation
> table is now an identiy transform.
> 
> No functional change.
> 
> Signed-off-by: Andrew Cooper 

Acked-by: Kevin Tian 


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH] x86/vvmx: Drop sreg_to_index[]

2017-01-03 Thread Jan Beulich
>>> On 03.01.17 at 12:58,  wrote:
> Since c/s 0888d36b "x86/emul: Correct the decoding of SReg3 operands",
> x86_seg_* have followed hardware encodings, meaning that this translation
> table is now an identiy transform.
> 
> No functional change.
> 
> Signed-off-by: Andrew Cooper 

Reviewed-by: Jan Beulich 


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH] x86/vvmx: Drop sreg_to_index[]

2017-01-03 Thread Andrew Cooper
Since c/s 0888d36b "x86/emul: Correct the decoding of SReg3 operands",
x86_seg_* have followed hardware encodings, meaning that this translation
table is now an identiy transform.

No functional change.

Signed-off-by: Andrew Cooper 
---
CC: Jan Beulich 
CC: Jun Nakajima 
CC: Kevin Tian 
---
 xen/arch/x86/hvm/vmx/vvmx.c| 15 +++
 xen/include/asm-x86/hvm/vmx/vvmx.h |  9 -
 2 files changed, 3 insertions(+), 21 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c
index d53c576..35e7825 100644
--- a/xen/arch/x86/hvm/vmx/vvmx.c
+++ b/xen/arch/x86/hvm/vmx/vvmx.c
@@ -191,15 +191,6 @@ bool_t nvmx_ept_enabled(struct vcpu *v)
 return !!(nvmx->ept.enabled);
 }
 
-static const enum x86_segment sreg_to_index[] = {
-[VMX_SREG_ES] = x86_seg_es,
-[VMX_SREG_CS] = x86_seg_cs,
-[VMX_SREG_SS] = x86_seg_ss,
-[VMX_SREG_DS] = x86_seg_ds,
-[VMX_SREG_FS] = x86_seg_fs,
-[VMX_SREG_GS] = x86_seg_gs,
-};
-
 struct vmx_inst_decoded {
 #define VMX_INST_MEMREG_TYPE_MEMORY 0
 #define VMX_INST_MEMREG_TYPE_REG1
@@ -418,9 +409,9 @@ static int decode_vmx_inst(struct cpu_user_regs *regs,
 
 decode->type = VMX_INST_MEMREG_TYPE_MEMORY;
 
-if ( info.fields.segment > VMX_SREG_GS )
+if ( info.fields.segment > x86_seg_gs )
 goto gp_fault;
-hvm_get_segment_register(v, sreg_to_index[info.fields.segment], );
+hvm_get_segment_register(v, info.fields.segment, );
 seg_base = seg.base;
 
 base = info.fields.base_reg_invalid ? 0 :
@@ -436,7 +427,7 @@ static int decode_vmx_inst(struct cpu_user_regs *regs,
 size = 1 << (info.fields.addr_size + 1);
 
 offset = base + index * scale + disp;
-base = !mode_64bit || info.fields.segment >= VMX_SREG_FS ?
+base = !mode_64bit || info.fields.segment >= x86_seg_fs ?
seg_base + offset : offset;
 if ( offset + size - 1 < offset ||
  (mode_64bit ?
diff --git a/xen/include/asm-x86/hvm/vmx/vvmx.h 
b/xen/include/asm-x86/hvm/vmx/vvmx.h
index af7702b..242e524 100644
--- a/xen/include/asm-x86/hvm/vmx/vvmx.h
+++ b/xen/include/asm-x86/hvm/vmx/vvmx.h
@@ -87,15 +87,6 @@ enum vmx_regs_enc {
 VMX_REG_R15,
 };
 
-enum vmx_sregs_enc {
-VMX_SREG_ES,
-VMX_SREG_CS,
-VMX_SREG_SS,
-VMX_SREG_DS,
-VMX_SREG_FS,
-VMX_SREG_GS,
-};
-
 union vmx_inst_info {
 struct {
 unsigned int scaling   :2; /* bit 0-1 */
-- 
2.1.4


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel