[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] xen/arm: regs: Convert guest_mode to a static inline helper



commit ce4cd9ab7cef8c7ed01a719e8aadb9d091b2fd4b
Author:     Julien Grall <julien.grall@xxxxxxx>
AuthorDate: Wed Oct 31 18:12:54 2018 +0000
Commit:     Stefano Stabellini <sstabellini@xxxxxxxxxx>
CommitDate: Fri Nov 9 10:14:10 2018 -0800

    xen/arm: regs: Convert guest_mode to a static inline helper
    
    At the same time, switch the parameter guest_mode from int to bool
    
    Signed-off-by: Julien Grall <julien.grall@xxxxxxx>
    Reviewed-by: Andrii Anisov <andrii_anisov@xxxxxxxx>
    Acked-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
---
 xen/arch/arm/traps.c       |  6 +++---
 xen/include/asm-arm/regs.h | 22 ++++++++++++----------
 2 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index e8fa760607..b9323672fc 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -789,7 +789,7 @@ static const char *mode_string(uint32_t cpsr)
 
 static void show_registers_32(const struct cpu_user_regs *regs,
                               const struct reg_ctxt *ctxt,
-                              int guest_mode,
+                              bool guest_mode,
                               const struct vcpu *v)
 {
 
@@ -866,7 +866,7 @@ static void show_registers_32(const struct cpu_user_regs 
*regs,
 #ifdef CONFIG_ARM_64
 static void show_registers_64(const struct cpu_user_regs *regs,
                               const struct reg_ctxt *ctxt,
-                              int guest_mode,
+                              bool guest_mode,
                               const struct vcpu *v)
 {
 
@@ -927,7 +927,7 @@ static void show_registers_64(const struct cpu_user_regs 
*regs,
 
 static void _show_registers(const struct cpu_user_regs *regs,
                             const struct reg_ctxt *ctxt,
-                            int guest_mode,
+                            bool guest_mode,
                             const struct vcpu *v)
 {
     print_xen_info();
diff --git a/xen/include/asm-arm/regs.h b/xen/include/asm-arm/regs.h
index 2440edb29a..ddc6eba9ce 100644
--- a/xen/include/asm-arm/regs.h
+++ b/xen/include/asm-arm/regs.h
@@ -5,8 +5,10 @@
 
 #ifndef __ASSEMBLY__
 
+#include <xen/lib.h>
 #include <xen/types.h>
 #include <public/xen.h>
+#include <asm/current.h>
 #include <asm/processor.h>
 
 #define psr_mode(psr,m) (((psr) & PSR_MODE_MASK) == m)
@@ -37,16 +39,16 @@
     (psr_mode((r)->cpsr,PSR_MODE_EL0t) || usr_mode(r))
 #endif
 
-#define guest_mode(r)                                                         \
-({                                                                            \
-    unsigned long diff = (char *)guest_cpu_user_regs() - (char *)(r);         \
-    /* Frame pointer must point into current CPU stack. */                    \
-    ASSERT(diff < STACK_SIZE);                                                \
-    /* If not a guest frame, it must be a hypervisor frame. */                \
-    ASSERT((diff == 0) || hyp_mode(r));                                       \
-    /* Return TRUE if it's a guest frame. */                                  \
-    (diff == 0);                                                              \
-})
+static inline bool guest_mode(const struct cpu_user_regs *r)
+{
+    unsigned long diff = (char *)guest_cpu_user_regs() - (char *)(r);
+    /* Frame pointer must point into current CPU stack. */
+    ASSERT(diff < STACK_SIZE);
+    /* If not a guest frame, it must be a hypervisor frame. */
+    ASSERT((diff == 0) || hyp_mode(r));
+    /* Return TRUE if it's a guest frame. */
+    return (diff == 0);
+}
 
 #define return_reg(v) ((v)->arch.cpu_info->guest_cpu_user_regs.r0)
 
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.