xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86emul: drop dead code from SYSENTER handling
@ 2016-12-07 14:02 Jan Beulich
  2016-12-07 15:34 ` Andrew Cooper
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Beulich @ 2016-12-07 14:02 UTC (permalink / raw)
  To: xen-devel; +Cc: Andrew Cooper

[-- Attachment #1: Type: text/plain, Size: 826 bytes --]

There's no point reading CS - all of the fields get set from scratch
right afterwards. Also correct a wrong comment.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -4841,12 +4841,10 @@ x86_emulate(
 
         _regs.eflags &= ~(EFLG_VM | EFLG_IF | EFLG_RF);
 
-        fail_if(ops->read_segment == NULL);
-        ops->read_segment(x86_seg_cs, &cs, ctxt);
         cs.sel = msr_content & ~3; /* SELECTOR_RPL_MASK */
         cs.base = 0;   /* flat segment */
         cs.limit = ~0u;  /* 4GB limit */
-        cs.attr.bytes = lm ? 0xa9b  /* L+DB+P+S+Code */
+        cs.attr.bytes = lm ? 0xa9b  /* L+G+P+S+Code */
                            : 0xc9b; /* G+DB+P+S+Code */
 
         sreg.sel = cs.sel + 8;




[-- Attachment #2: x86emul-sysenter-dead-code.patch --]
[-- Type: text/plain, Size: 870 bytes --]

x86emul: drop dead code from SYSENTER handling

There's no point reading CS - all of the fields get set from scratch
right afterwards. Also correct a wrong comment.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -4841,12 +4841,10 @@ x86_emulate(
 
         _regs.eflags &= ~(EFLG_VM | EFLG_IF | EFLG_RF);
 
-        fail_if(ops->read_segment == NULL);
-        ops->read_segment(x86_seg_cs, &cs, ctxt);
         cs.sel = msr_content & ~3; /* SELECTOR_RPL_MASK */
         cs.base = 0;   /* flat segment */
         cs.limit = ~0u;  /* 4GB limit */
-        cs.attr.bytes = lm ? 0xa9b  /* L+DB+P+S+Code */
+        cs.attr.bytes = lm ? 0xa9b  /* L+G+P+S+Code */
                            : 0xc9b; /* G+DB+P+S+Code */
 
         sreg.sel = cs.sel + 8;

[-- Attachment #3: Type: text/plain, Size: 127 bytes --]

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] x86emul: drop dead code from SYSENTER handling
  2016-12-07 14:02 [PATCH] x86emul: drop dead code from SYSENTER handling Jan Beulich
@ 2016-12-07 15:34 ` Andrew Cooper
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Cooper @ 2016-12-07 15:34 UTC (permalink / raw)
  To: Jan Beulich, xen-devel

On 07/12/16 14:02, Jan Beulich wrote:
> There's no point reading CS - all of the fields get set from scratch
> right afterwards. Also correct a wrong comment.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>, although

>
> --- a/xen/arch/x86/x86_emulate/x86_emulate.c
> +++ b/xen/arch/x86/x86_emulate/x86_emulate.c
> @@ -4841,12 +4841,10 @@ x86_emulate(
>  
>          _regs.eflags &= ~(EFLG_VM | EFLG_IF | EFLG_RF);
>  
> -        fail_if(ops->read_segment == NULL);
> -        ops->read_segment(x86_seg_cs, &cs, ctxt);
>          cs.sel = msr_content & ~3; /* SELECTOR_RPL_MASK */
>          cs.base = 0;   /* flat segment */
>          cs.limit = ~0u;  /* 4GB limit */
> -        cs.attr.bytes = lm ? 0xa9b  /* L+DB+P+S+Code */
> +        cs.attr.bytes = lm ? 0xa9b  /* L+G+P+S+Code */

Strictly speaking its G+L+P, seeing as the other attributes are listed
in bit order.

~Andrew

>                             : 0xc9b; /* G+DB+P+S+Code */
>  
>          sreg.sel = cs.sel + 8;
>
>
>


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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-12-07 15:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-07 14:02 [PATCH] x86emul: drop dead code from SYSENTER handling Jan Beulich
2016-12-07 15:34 ` Andrew Cooper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).