Skip to contentSkip to conversation

x86/vvmx: Drop sreg_to_index[]

PATCH In review Andrew Cooper 3 participants 3 messages Jan 3, 2017 – Jan 5, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/vvmx: Drop sreg_to_index[]

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.

---
CC: Jan Beulich <[email protected]>
CC: Jun Nakajima <[email protected]>
CC: Kevin Tian <[email protected]>

---
 xen/arch/x86/hvm/vmx/vvmx.c        | 15 +++------------
 xen/include/asm-x86/hvm/vmx/vvmx.h |  9 ---------
 2 files changed, 3 insertions(+), 21 deletions(-)
xen/arch/x86/hvm/vmx/vvmx.c +3 -12
index d53c576..35e7825 100644
@@ -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_REG    1
@@ -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], &seg);
+        hvm_get_segment_register(v, info.fields.segment, &seg);
         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 ?
xen/include/asm-x86/hvm/vmx/vvmx.h +0 -9
index af7702b..242e524 100644
@@ -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 */
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 03.01.17 at 12:58, <[email protected]> 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.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Acked-by on v1 1/1
#2 lore raw
In reply to Andrew Cooper
Quoted 10 lines

From: Andrew Cooper [mailto:[email protected]]
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.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel