All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu2@citrix.com>
To: Xen-devel <xen-devel@lists.xenproject.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	Wei Liu <wei.liu2@citrix.com>, Jan Beulich <JBeulich@suse.com>
Subject: [PATCH v2 05/18] x86/pv: clean up emulate_ops.c
Date: Fri, 5 May 2017 15:48:23 +0100	[thread overview]
Message-ID: <20170505144836.8612-6-wei.liu2@citrix.com> (raw)
In-Reply-To: <20170505144836.8612-1-wei.liu2@citrix.com>

Replace bool_t with bool.

Change check_stack_limit to return bool.

Fix some coding style issues.

Undef TOGGLE_MODE when it is no longer needed.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
 xen/arch/x86/pv/emulate_ops.c | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/xen/arch/x86/pv/emulate_ops.c b/xen/arch/x86/pv/emulate_ops.c
index 5f0965e05b..97c8d14859 100644
--- a/xen/arch/x86/pv/emulate_ops.c
+++ b/xen/arch/x86/pv/emulate_ops.c
@@ -138,7 +138,7 @@ static int read_descriptor(unsigned int sel,
                            unsigned long *base,
                            unsigned long *limit,
                            unsigned int *ar,
-                           bool_t insn_fetch)
+                           bool insn_fetch)
 {
     struct desc_struct desc;
 
@@ -274,7 +274,7 @@ static int priv_op_read_segment(enum x86_segment seg,
 }
 
 /* Perform IOPL check between the vcpu's shadowed IOPL, and the assumed cpl. */
-static bool_t iopl_ok(const struct vcpu *v, const struct cpu_user_regs *regs)
+static bool iopl_ok(const struct vcpu *v, const struct cpu_user_regs *regs)
 {
     unsigned int cpl = guest_kernel_mode(v, regs) ?
         (VM_ASSIST(v->domain, architectural_iopl) ? 0 : 1) : 3;
@@ -318,9 +318,8 @@ static io_emul_stub_t *io_emul_stub_setup(struct priv_op_ctxt *ctxt, u8 opcode,
 }
 
 /* Has the guest requested sufficient permission for this I/O access? */
-static int guest_io_okay(
-    unsigned int port, unsigned int bytes,
-    struct vcpu *v, struct cpu_user_regs *regs)
+static int guest_io_okay(unsigned int port, unsigned int bytes,
+                         struct vcpu *v, struct cpu_user_regs *regs)
 {
     /* If in user mode, switch to kernel mode just to read I/O bitmap. */
     int user_mode = !(v->arch.flags & TF_kernel_mode);
@@ -353,11 +352,13 @@ static int guest_io_okay(
             return 1;
     }
 
+#undef TOGGLE_MODE
     return 0;
 }
 
 static unsigned int check_guest_io_breakpoint(struct vcpu *v,
-    unsigned int port, unsigned int len)
+                                              unsigned int port,
+                                              unsigned int len)
 {
     unsigned int width, i, match = 0;
     unsigned long start;
@@ -392,8 +393,8 @@ static unsigned int check_guest_io_breakpoint(struct vcpu *v,
 }
 
 /* Has the administrator granted sufficient permission for this I/O access? */
-static bool_t admin_io_okay(unsigned int port, unsigned int bytes,
-                            const struct domain *d)
+static bool admin_io_okay(unsigned int port, unsigned int bytes,
+                          const struct domain *d)
 {
     /*
      * Port 0xcf8 (CONFIG_ADDRESS) is only visible for DWORD accesses.
@@ -409,8 +410,8 @@ static bool_t admin_io_okay(unsigned int port, unsigned int bytes,
     return ioports_access_permitted(d, port, port + bytes - 1);
 }
 
-static bool_t pci_cfg_ok(struct domain *currd, unsigned int start,
-                         unsigned int size, uint32_t *write)
+static bool pci_cfg_ok(struct domain *currd, unsigned int start,
+                       unsigned int size, uint32_t *write)
 {
     uint32_t machine_bdf;
 
@@ -518,7 +519,8 @@ void guest_io_write(unsigned int port, unsigned int bytes, uint32_t data,
 {
     if ( admin_io_okay(port, bytes, currd) )
     {
-        switch ( bytes ) {
+        switch ( bytes )
+        {
         case 1:
             outb((uint8_t)data, port);
             if ( pv_post_outb_hook )
@@ -1587,8 +1589,8 @@ static int read_gate_descriptor(unsigned int gate_sel,
     return 1;
 }
 
-static inline int check_stack_limit(unsigned int ar, unsigned int limit,
-                                    unsigned int esp, unsigned int decr)
+static inline bool check_stack_limit(unsigned int ar, unsigned int limit,
+                                     unsigned int esp, unsigned int decr)
 {
     return (((esp - decr) < (esp - 1)) &&
             (!(ar & _SEGMENT_EC) ? (esp - 1) <= limit : (esp - decr) > limit));
-- 
2.11.0


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

  parent reply	other threads:[~2017-05-05 14:48 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-05 14:48 [PATCH v2 00/18] Refactor x86 trap handling code Wei Liu
2017-05-05 14:48 ` [PATCH v2 01/18] x86/traps: factor out pv_percpu_traps_init Wei Liu
2017-05-05 16:12   ` Andrew Cooper
2017-05-12 12:00     ` Wei Liu
2017-05-05 14:48 ` [PATCH v2 02/18] x86/traps: export trapstr Wei Liu
2017-05-05 14:48 ` [PATCH v2 03/18] x86/traps: lift do_guest_trap to domain.h Wei Liu
2017-05-12 18:16   ` Andrew Cooper
2017-05-12 18:26     ` Andrew Cooper
2017-05-15  7:50     ` Jan Beulich
2017-05-05 14:48 ` [PATCH v2 04/18] x86/traps: move all PV emulation code to pv/emulate_ops.h Wei Liu
2017-05-11 10:18   ` Andrew Cooper
2017-05-12 12:00     ` Wei Liu
2017-05-05 14:48 ` Wei Liu [this message]
2017-05-11 11:22   ` [PATCH v2 05/18] x86/pv: clean up emulate_ops.c Andrew Cooper
2017-05-12 12:02     ` Wei Liu
2017-05-12 12:03       ` Wei Liu
2017-05-05 14:48 ` [PATCH v2 06/18] x86/traps: move PV hypercall handlers to pv/traps.c Wei Liu
2017-05-05 14:48 ` [PATCH v2 07/18] x86/traps: move pv_inject_event " Wei Liu
2017-05-05 14:48 ` [PATCH v2 08/18] x86/traps: move set_guest_{machinecheck, nmi}_trapbounce Wei Liu
2017-05-05 14:48 ` [PATCH v2 09/18] x86/traps: move {un, }register_guest_nmi_callback Wei Liu
2017-05-05 14:48 ` [PATCH v2 10/18] x86/traps: delcare percpu softirq_trap Wei Liu
2017-05-05 14:48 ` [PATCH v2 11/18] x86/traps: move guest_has_trap_callback to pv/traps.c Wei Liu
2017-05-05 14:48 ` [PATCH v2 12/18] x86/traps: move send_guest_trap " Wei Liu
2017-05-05 14:48 ` [PATCH v2 13/18] x86/traps: move PV specific code in x86_64/traps.c Wei Liu
2017-05-05 14:48 ` [PATCH v2 14/18] x86/traps: merge x86_64/compat/traps.c into pv/traps.c Wei Liu
2017-05-05 14:48 ` [PATCH v2 15/18] x86: clean up pv/traps.c Wei Liu
2017-05-05 14:48 ` [PATCH v2 16/18] x86: guest_has_trap_callback should return bool Wei Liu
2017-05-05 14:48 ` [PATCH v2 17/18] x86: fix coding style issues in asm-x86/traps.h Wei Liu
2017-05-05 14:48 ` [PATCH v2 18/18] x86: clean up traps.c Wei Liu
2017-05-09 10:50 ` [PATCH v2 00/18] Refactor x86 trap handling code Andrew Cooper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170505144836.8612-6-wei.liu2@citrix.com \
    --to=wei.liu2@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.