Message ID | 1458064616-23101-7-git-send-email-konrad.wilk@oracle.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi Konrad, On 15/03/2016 17:56, Konrad Rzeszutek Wilk wrote: > So that we have a nice mechansim to figure out the upper > bounds of bug.frames and also catch compiler errors in case > one tries to use a higher frame number. > > Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> For the ARM part: Acked-by: Julien Grall <julien.grall@arm.com> Regards,
>>> On 15.03.16 at 18:56, <konrad.wilk@oracle.com> wrote: > --- a/xen/include/asm-arm/bug.h > +++ b/xen/include/asm-arm/bug.h > @@ -31,6 +31,7 @@ struct bug_frame { > #define BUGFRAME_warn 0 > #define BUGFRAME_bug 1 > #define BUGFRAME_assert 2 > +#define BUGFRAME_NR 3 > > /* Many versions of GCC doesn't support the asm %c parameter which would > * be preferable to this unpleasantness. We use mergeable string > @@ -39,6 +40,7 @@ struct bug_frame { > */ > #define BUG_FRAME(type, line, file, has_msg, msg) do { \ > BUILD_BUG_ON((line) >> 16); \ > + BUILD_BUG_ON(type >= BUGFRAME_NR); \ The x86 variant has type properly parenthesized - why not here? > --- a/xen/include/asm-x86/bug.h > +++ b/xen/include/asm-x86/bug.h > @@ -9,7 +9,7 @@ > #define BUGFRAME_warn 1 > #define BUGFRAME_bug 2 > #define BUGFRAME_assert 3 > - > +#define BUGFRAME_NR 4 > #ifndef __ASSEMBLY__ Please retain the blank line. > @@ -51,6 +51,7 @@ struct bug_frame { > > #define BUG_FRAME(type, line, ptr, second_frame, msg) do { \ > BUILD_BUG_ON((line) >> (BUG_LINE_LO_WIDTH + BUG_LINE_HI_WIDTH)); \ > + BUILD_BUG_ON((type) >= (BUGFRAME_NR)); \ The ARM variant has BUGFRAME_NR properly un-parenthesized - why here? Jan
diff --git a/xen/include/asm-arm/bug.h b/xen/include/asm-arm/bug.h index ab9e811..4df6b2a 100644 --- a/xen/include/asm-arm/bug.h +++ b/xen/include/asm-arm/bug.h @@ -31,6 +31,7 @@ struct bug_frame { #define BUGFRAME_warn 0 #define BUGFRAME_bug 1 #define BUGFRAME_assert 2 +#define BUGFRAME_NR 3 /* Many versions of GCC doesn't support the asm %c parameter which would * be preferable to this unpleasantness. We use mergeable string @@ -39,6 +40,7 @@ struct bug_frame { */ #define BUG_FRAME(type, line, file, has_msg, msg) do { \ BUILD_BUG_ON((line) >> 16); \ + BUILD_BUG_ON(type >= BUGFRAME_NR); \ asm ("1:"BUG_INSTR"\n" \ ".pushsection .rodata.str, \"aMS\", %progbits, 1\n" \ "2:\t.asciz " __stringify(file) "\n" \ diff --git a/xen/include/asm-x86/bug.h b/xen/include/asm-x86/bug.h index e868e85..bd17ade 100644 --- a/xen/include/asm-x86/bug.h +++ b/xen/include/asm-x86/bug.h @@ -9,7 +9,7 @@ #define BUGFRAME_warn 1 #define BUGFRAME_bug 2 #define BUGFRAME_assert 3 - +#define BUGFRAME_NR 4 #ifndef __ASSEMBLY__ struct bug_frame { @@ -51,6 +51,7 @@ struct bug_frame { #define BUG_FRAME(type, line, ptr, second_frame, msg) do { \ BUILD_BUG_ON((line) >> (BUG_LINE_LO_WIDTH + BUG_LINE_HI_WIDTH)); \ + BUILD_BUG_ON((type) >= (BUGFRAME_NR)); \ asm volatile ( _ASM_BUGFRAME_TEXT(second_frame) \ :: _ASM_BUGFRAME_INFO(type, line, ptr, msg) ); \ } while (0)
So that we have a nice mechansim to figure out the upper bounds of bug.frames and also catch compiler errors in case one tries to use a higher frame number. Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> --- Cc: Stefano Stabellini <stefano.stabellini@citrix.com> Cc: Julien Grall <julien.grall@arm.com> Cc: Keir Fraser <keir@xen.org> Cc: Jan Beulich <jbeulich@suse.com> Cc: Andrew Cooper <andrew.cooper3@citrix.com> --- --- xen/include/asm-arm/bug.h | 2 ++ xen/include/asm-x86/bug.h | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-)