Use byteorder macros to deal with endianness while declaring breakpoint instruction in arch_kgdb_ops. Use the KGDB_BREAKINST macro instead of hardcoding the breakpoint instruction in hexadecimal.
Signed-off-by: Vincent Stehlé <[email protected]> Cc: Jason Wessel <[email protected]> Cc: [email protected] --- Hi, I would like to propose the following changes in the way the kgdb breakpoint instructions are declared. This has the benefit to remove one hardcoded value, and to get rid of the if/else on __ARMEB__. Also, this should ease support of thumb2 kernel. What is your opinion on this, please? This has been tested good on an (ARMEB) OMAP5 platform. Best regards, V. arch/arm/kernel/kgdb.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/arch/arm/kernel/kgdb.c b/arch/arm/kernel/kgdb.c index 778c2f7..71e2550 100644 --- a/arch/arm/kernel/kgdb.c +++ b/arch/arm/kernel/kgdb.c @@ -13,6 +13,7 @@ #include <linux/kdebug.h> #include <linux/kgdb.h> #include <asm/traps.h> +#include <asm/byteorder.h> struct dbg_reg_def_t dbg_reg_def[DBG_MAX_REG_NUM] = { @@ -246,10 +247,12 @@ void kgdb_arch_exit(void) * and we handle the normal undef case within the do_undefinstr * handler. */ + +#define __bpt_byte(W, N) ((__constant_be32_to_cpu(W) >> ((N) * 8)) & 0xff) + +#define __bpt_instr(W) {__bpt_byte(W, 3), __bpt_byte(W, 2), \ + __bpt_byte(W, 1), __bpt_byte(W, 0)} + struct kgdb_arch arch_kgdb_ops = { -#ifndef __ARMEB__ - .gdb_bpt_instr = {0xfe, 0xde, 0xff, 0xe7} -#else /* ! __ARMEB__ */ - .gdb_bpt_instr = {0xe7, 0xff, 0xde, 0xfe} -#endif + .gdb_bpt_instr = __bpt_instr(KGDB_BREAKINST) }; -- 1.8.1.2 ------------------------------------------------------------------------------ Precog is a next-generation analytics platform capable of advanced analytics on semi-structured data. The platform includes APIs for building apps and a phenomenal toolset for data science. Developers can use our toolset for easy data analysis & visualization. Get a free account! http://www2.precog.com/precogplatform/slashdotnewsletter _______________________________________________ Kgdb-bugreport mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/kgdb-bugreport
