[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <201112171415.57601.vapier@gentoo.org>
Date: Sat, 17 Dec 2011 14:15:55 -0500
From: Mike Frysinger <vapier@...too.org>
To: David Howells <dhowells@...hat.com>
Cc: linux-arch@...r.kernel.org, mingo@...e.hu,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/7] Add conditional oopsing with annotation
On Friday 16 December 2011 09:13:57 David Howells wrote:
> --- a/arch/x86/include/asm/bug.h
> +++ b/arch/x86/include/asm/bug.h
>
> +extern const void __arch_annotated_bug;
> +#define arch_annotated_bug(desc) \
> + do { \
> + asm volatile(".globl __arch_annotated_bug\n" \
> + "__arch_annotated_bug:\n" \
> + " ud2\n" \
> + : : "d" (desc)); \
> + unreachable(); \
> + } while (0)
> +
> +#define is_arch_annotated_bug(regs) \
> + ({ ((const void *)regs->ip == &__arch_annotated_bug) ? \
> + (struct annotated_bug *)regs->dx : NULL; })
seems like this is making arches duplicate a bit of logic they shouldn't have
to ... you could have asm-generic/bug.h do:
#ifdef arch_annotated_bug_fail
extern const void __arch_annotated_bug;
# define ARCH_ANNOTATED_SYM_STR CONFIG_SYMBOL_PREFIX"__arch_annotated_bug"
# define arch_annotated_bug(desc) \
do { \
asm volatile(".globl " ARCH_ANNOTATED_SYM ";\n" \
ARCH_ANNOTATED_SYM_STR":\n"); \
arch_annotated_bug_fail(desc) ; \
unreachable(); \
} while (0)
# define is_arch_annotated_bug(regs) \
({ (instruction_pointer(regs) == &__arch_annotated_bug) ? \
(struct annotated_bug *)arch_annotated_bug_struct(regs) : \
NULL; })
#endif
so now arches have to define two small bits. in the x86 case:
#define arch_annotated_bug_fail(desc) asm volatile("ud2;" : : "d" (desc))
#define arch_annotated_bug_struct(regs) (regs)->dx
-mike
Download attachment "signature.asc " of type "application/pgp-signature" (837 bytes)
Powered by blists - more mailing lists