xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86emul: constify write_segment() register pointer
@ 2016-12-08 11:53 Jan Beulich
  2016-12-08 12:56 ` Paul Durrant
  2016-12-08 14:04 ` Andrew Cooper
  0 siblings, 2 replies; 3+ messages in thread
From: Jan Beulich @ 2016-12-08 11:53 UTC (permalink / raw)
  To: xen-devel; +Cc: Andrew Cooper, Paul Durrant

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

Since I stumbled across this while looking for further constification
opportunities, also correct the insn_fetch() related comment.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
I would have wanted to also constify the pointers passed to .write(),
.cmpxchg(), and .rep_stos(), but that doesn't work (not only) because
of hvmemul_do_mmio_buffer() being used for both directions.

--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -1439,7 +1439,7 @@ static int hvmemul_read_segment(
 
 static int hvmemul_write_segment(
     enum x86_segment seg,
-    struct segment_register *reg,
+    const struct segment_register *reg,
     struct x86_emulate_ctxt *ctxt)
 {
     struct hvm_emulate_ctxt *hvmemul_ctxt =
--- a/xen/arch/x86/x86_emulate/x86_emulate.h
+++ b/xen/arch/x86/x86_emulate/x86_emulate.h
@@ -200,7 +200,10 @@ struct x86_emulate_ops
 
     /*
      * insn_fetch: Emulate fetch from instruction byte stream.
-     *  Parameters are same as for 'read'. @seg is always x86_seg_cs.
+     *  Except for @bytes parameters are same as for 'read'.
+     *  @bytes: Access length (0 <= @bytes < 16, with zero meaning
+     *  "validate address only").
+     *  @seg is always x86_seg_cs.
      */
     int (*insn_fetch)(
         enum x86_segment seg,
@@ -306,7 +309,7 @@ struct x86_emulate_ops
      */
     int (*write_segment)(
         enum x86_segment seg,
-        struct segment_register *reg,
+        const struct segment_register *reg,
         struct x86_emulate_ctxt *ctxt);
 
     /*




[-- Attachment #2: x86emul-write_segment-const.patch --]
[-- Type: text/plain, Size: 1616 bytes --]

x86emul: constify write_segment() register pointer

Since I stumbled across this while looking for further constification
opportunities, also correct the insn_fetch() related comment.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
I would have wanted to also constify the pointers passed to .write(),
.cmpxchg(), and .rep_stos(), but that doesn't work (not only) because
of hvmemul_do_mmio_buffer() being used for both directions.

--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -1439,7 +1439,7 @@ static int hvmemul_read_segment(
 
 static int hvmemul_write_segment(
     enum x86_segment seg,
-    struct segment_register *reg,
+    const struct segment_register *reg,
     struct x86_emulate_ctxt *ctxt)
 {
     struct hvm_emulate_ctxt *hvmemul_ctxt =
--- a/xen/arch/x86/x86_emulate/x86_emulate.h
+++ b/xen/arch/x86/x86_emulate/x86_emulate.h
@@ -200,7 +200,10 @@ struct x86_emulate_ops
 
     /*
      * insn_fetch: Emulate fetch from instruction byte stream.
-     *  Parameters are same as for 'read'. @seg is always x86_seg_cs.
+     *  Except for @bytes parameters are same as for 'read'.
+     *  @bytes: Access length (0 <= @bytes < 16, with zero meaning
+     *  "validate address only").
+     *  @seg is always x86_seg_cs.
      */
     int (*insn_fetch)(
         enum x86_segment seg,
@@ -306,7 +309,7 @@ struct x86_emulate_ops
      */
     int (*write_segment)(
         enum x86_segment seg,
-        struct segment_register *reg,
+        const struct segment_register *reg,
         struct x86_emulate_ctxt *ctxt);
 
     /*

[-- 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] 3+ messages in thread

* Re: [PATCH] x86emul: constify write_segment() register pointer
  2016-12-08 11:53 [PATCH] x86emul: constify write_segment() register pointer Jan Beulich
@ 2016-12-08 12:56 ` Paul Durrant
  2016-12-08 14:04 ` Andrew Cooper
  1 sibling, 0 replies; 3+ messages in thread
From: Paul Durrant @ 2016-12-08 12:56 UTC (permalink / raw)
  To: Jan Beulich, xen-devel; +Cc: Andrew Cooper

> -----Original Message-----
> From: Jan Beulich [mailto:JBeulich@suse.com]
> Sent: 08 December 2016 11:53
> To: xen-devel <xen-devel@lists.xenproject.org>
> Cc: Andrew Cooper <Andrew.Cooper3@citrix.com>; Paul Durrant
> <Paul.Durrant@citrix.com>
> Subject: [PATCH] x86emul: constify write_segment() register pointer
> 
> Since I stumbled across this while looking for further constification
> opportunities, also correct the insn_fetch() related comment.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Paul Durrant <paul.durrant@citrix.com>

> ---
> I would have wanted to also constify the pointers passed to .write(),
> .cmpxchg(), and .rep_stos(), but that doesn't work (not only) because
> of hvmemul_do_mmio_buffer() being used for both directions.
> 
> --- a/xen/arch/x86/hvm/emulate.c
> +++ b/xen/arch/x86/hvm/emulate.c
> @@ -1439,7 +1439,7 @@ static int hvmemul_read_segment(
> 
>  static int hvmemul_write_segment(
>      enum x86_segment seg,
> -    struct segment_register *reg,
> +    const struct segment_register *reg,
>      struct x86_emulate_ctxt *ctxt)
>  {
>      struct hvm_emulate_ctxt *hvmemul_ctxt =
> --- a/xen/arch/x86/x86_emulate/x86_emulate.h
> +++ b/xen/arch/x86/x86_emulate/x86_emulate.h
> @@ -200,7 +200,10 @@ struct x86_emulate_ops
> 
>      /*
>       * insn_fetch: Emulate fetch from instruction byte stream.
> -     *  Parameters are same as for 'read'. @seg is always x86_seg_cs.
> +     *  Except for @bytes parameters are same as for 'read'.
> +     *  @bytes: Access length (0 <= @bytes < 16, with zero meaning
> +     *  "validate address only").
> +     *  @seg is always x86_seg_cs.
>       */
>      int (*insn_fetch)(
>          enum x86_segment seg,
> @@ -306,7 +309,7 @@ struct x86_emulate_ops
>       */
>      int (*write_segment)(
>          enum x86_segment seg,
> -        struct segment_register *reg,
> +        const struct segment_register *reg,
>          struct x86_emulate_ctxt *ctxt);
> 
>      /*
> 
> 


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

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

* Re: [PATCH] x86emul: constify write_segment() register pointer
  2016-12-08 11:53 [PATCH] x86emul: constify write_segment() register pointer Jan Beulich
  2016-12-08 12:56 ` Paul Durrant
@ 2016-12-08 14:04 ` Andrew Cooper
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Cooper @ 2016-12-08 14:04 UTC (permalink / raw)
  To: Jan Beulich, xen-devel; +Cc: Paul Durrant

On 08/12/16 11:53, Jan Beulich wrote:
> Since I stumbled across this while looking for further constification
> opportunities, also correct the insn_fetch() related comment.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>, although a
suggestion about the wording.

> ---
> I would have wanted to also constify the pointers passed to .write(),
> .cmpxchg(), and .rep_stos(), but that doesn't work (not only) because
> of hvmemul_do_mmio_buffer() being used for both directions.
>
> --- a/xen/arch/x86/hvm/emulate.c
> +++ b/xen/arch/x86/hvm/emulate.c
> @@ -1439,7 +1439,7 @@ static int hvmemul_read_segment(
>  
>  static int hvmemul_write_segment(
>      enum x86_segment seg,
> -    struct segment_register *reg,
> +    const struct segment_register *reg,
>      struct x86_emulate_ctxt *ctxt)
>  {
>      struct hvm_emulate_ctxt *hvmemul_ctxt =
> --- a/xen/arch/x86/x86_emulate/x86_emulate.h
> +++ b/xen/arch/x86/x86_emulate/x86_emulate.h
> @@ -200,7 +200,10 @@ struct x86_emulate_ops
>  
>      /*
>       * insn_fetch: Emulate fetch from instruction byte stream.
> -     *  Parameters are same as for 'read'. @seg is always x86_seg_cs.
> +     *  Except for @bytes parameters are same as for 'read'.

"Except for @bytes, all parameters are the same..."

> +     *  @bytes: Access length (0 <= @bytes < 16, with zero meaning
> +     *  "validate address only").
> +     *  @seg is always x86_seg_cs.
>       */
>      int (*insn_fetch)(
>          enum x86_segment seg,
> @@ -306,7 +309,7 @@ struct x86_emulate_ops
>       */
>      int (*write_segment)(
>          enum x86_segment seg,
> -        struct segment_register *reg,
> +        const struct segment_register *reg,
>          struct x86_emulate_ctxt *ctxt);
>  
>      /*
>
>
>


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

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

end of thread, other threads:[~2016-12-08 14:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-08 11:53 [PATCH] x86emul: constify write_segment() register pointer Jan Beulich
2016-12-08 12:56 ` Paul Durrant
2016-12-08 14:04 ` 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).