Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM: kdgb: use <asm/opcodes.h> for data to be assembled as intruction

The arch_kgdb_breakpoint() function uses an inline assembly directive
to assemble a specific instruction using .word. This means the linker
will not treat is as an instruction, and therefore incorrectly swap
the endian-ness if running BE8.

As noted, this code means that kgdb is really only usable on arm32
kernels, and should be made dependant on not being a thumb2 kernel
until fixed. However this is not something to be added to this patch.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Reviewed-by: Dave Martin <Dave.Martin@arm.com>

Ben Dooks 5a8b93fc 63328070

+2 -1
+2 -1
arch/arm/include/asm/kgdb.h
··· 11 11 #define __ARM_KGDB_H__ 12 12 13 13 #include <linux/ptrace.h> 14 + #include <asm/opcodes.h> 14 15 15 16 /* 16 17 * GDB assumes that we're a user process being debugged, so ··· 42 41 43 42 static inline void arch_kgdb_breakpoint(void) 44 43 { 45 - asm(".word 0xe7ffdeff"); 44 + asm(__inst_arm(0xe7ffdeff)); 46 45 } 47 46 48 47 extern void kgdb_handle_bus_error(void);