Subject: [PATCH] ARM: kdgb: use .inst for data to be assembled as intruction

From: [email-masked] (Ben Dooks)
Date: Thu, 25 Jul 2013 18:13:18 +0100

On 25/07/13 18:11, Dave Martin wrote:
> On Thu, Jul 25, 2013 at 03:49:38PM +0100, Ben Dooks wrote:
>> 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.
>>
>> Note, not tested, please comment if this is wrong.
>>
>> Signed-off-by: Ben Dooks<[email-masked]>
>> ---
>>   arch/arm/include/asm/kgdb.h |    2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/arm/include/asm/kgdb.h b/arch/arm/include/asm/kgdb.h
>> index 48066ce..76227c8 100644
>> --- a/arch/arm/include/asm/kgdb.h
>> +++ b/arch/arm/include/asm/kgdb.h
>> @@ -41,7 +41,7 @@
>>
>>   static inline void arch_kgdb_breakpoint(void)
>>   {
>> -	asm(".word 0xe7ffdeff");
>> +	asm(".inst 0xe7ffdeff");
>
> Yikes, this isn't going to work in a Thumb kernel.
>
> We should make HAVE_ARCH_KGDB depend on !THUMB2_KERNEL until/unless that
> gets fixed...  It looks like the incompatibilities may be more extensive
> than just this one instruction.
>
>
> For the ARM case, similarly to the other patches, please use the __inst
> macros from<asm/opcodes.h>  instead of emitting the opcode explicitly.

See previous objections to that, plus they're marked for internal use
only!

-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius