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

[Xen-changelog] [xen master] x86/bug: break out the internals of BUG_FRAME()



commit d90b8f8c9fa7ebc07aa0e5f3e553411434ae8ac5
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Tue Nov 3 18:14:49 2015 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Nov 3 18:14:49 2015 +0100

    x86/bug: break out the internals of BUG_FRAME()
    
    To allow bug frames can be created inside existing asm() statements.  In
    order to do so, the current bugframe positional parameters are altered
    to be named parameters, to avoid interactions with the parameters of the
    existing asm() statement.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/include/asm-x86/bug.h |   37 ++++++++++++++++++++++---------------
 1 files changed, 22 insertions(+), 15 deletions(-)

diff --git a/xen/include/asm-x86/bug.h b/xen/include/asm-x86/bug.h
index cec6bce..e868e85 100644
--- a/xen/include/asm-x86/bug.h
+++ b/xen/include/asm-x86/bug.h
@@ -29,23 +29,30 @@ struct bug_frame {
                       ((1 << BUG_LINE_LO_WIDTH) - 1)))
 #define bug_msg(b) ((const char *)(b) + (b)->msg_disp[1])
 
+#define _ASM_BUGFRAME_TEXT(second_frame)                                     \
+    ".Lbug%=: ud2\n"                                                         \
+    ".pushsection .bug_frames.%c[bf_type], \"a\", @progbits\n"               \
+    ".p2align 2\n"                                                           \
+    ".Lfrm%=:\n"                                                             \
+    ".long (.Lbug%= - .Lfrm%=) + %c[bf_line_hi]\n"                           \
+    ".long (%c[bf_ptr] - .Lfrm%=) + %c[bf_line_lo]\n"                        \
+    ".if " #second_frame "\n"                                                \
+    ".long 0, %c[bf_msg] - .Lfrm%=\n"                                        \
+    ".endif\n"                                                               \
+    ".popsection\n"                                                          \
+
+#define _ASM_BUGFRAME_INFO(type, line, ptr, msg)                             \
+    [bf_type]    "i" (type),                                                 \
+    [bf_ptr]     "i" (ptr),                                                  \
+    [bf_msg]     "i" (msg),                                                  \
+    [bf_line_lo] "i" ((line & ((1 << BUG_LINE_LO_WIDTH) - 1))                \
+                      << BUG_DISP_WIDTH),                                    \
+    [bf_line_hi] "i" (((line) >> BUG_LINE_LO_WIDTH) << BUG_DISP_WIDTH)
+
 #define BUG_FRAME(type, line, ptr, second_frame, msg) do {                   \
     BUILD_BUG_ON((line) >> (BUG_LINE_LO_WIDTH + BUG_LINE_HI_WIDTH));         \
-    asm volatile ( ".Lbug%=: ud2\n"                                          \
-                   ".pushsection .bug_frames.%c0, \"a\", @progbits\n"        \
-                   ".p2align 2\n"                                            \
-                   ".Lfrm%=:\n"                                              \
-                   ".long (.Lbug%= - .Lfrm%=) + %c4\n"                       \
-                   ".long (%c1 - .Lfrm%=) + %c3\n"                           \
-                   ".if " #second_frame "\n"                                 \
-                   ".long 0, %c2 - .Lfrm%=\n"                                \
-                   ".endif\n"                                                \
-                   ".popsection"                                             \
-                   :                                                         \
-                   : "i" (type), "i" (ptr), "i" (msg),                       \
-                     "i" ((line & ((1 << BUG_LINE_LO_WIDTH) - 1))            \
-                          << BUG_DISP_WIDTH),                                \
-                     "i" (((line) >> BUG_LINE_LO_WIDTH) << BUG_DISP_WIDTH)); \
+    asm volatile ( _ASM_BUGFRAME_TEXT(second_frame)                          \
+                   :: _ASM_BUGFRAME_INFO(type, line, ptr, msg) );            \
 } while (0)
 
 
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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