All of lore.kernel.org
 help / color / mirror / Atom feed
* BE8 patch updates
@ 2013-08-14 16:42 Ben Dooks
  2013-08-14 16:42 ` [PATCH 1/3] ARM: Correct BUG() assembly to ensure it is endian-agnostic Ben Dooks
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Ben Dooks @ 2013-08-14 16:42 UTC (permalink / raw)
  To: linux-arm-kernel

Updated fixes for BE8 support.

These change the previous fixes to use <asm/opcodes.h> to deal with
instruction generation.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/3] ARM: Correct BUG() assembly to ensure it is endian-agnostic
  2013-08-14 16:42 BE8 patch updates Ben Dooks
@ 2013-08-14 16:42 ` Ben Dooks
  2013-08-14 16:42 ` [PATCH 2/3] ARM: fix BUG() detection Ben Dooks
  2013-08-14 16:42 ` [PATCH 3/3] ARM: kdgb: use <asm/opcodes.h> for data to be assembled as intruction Ben Dooks
  2 siblings, 0 replies; 8+ messages in thread
From: Ben Dooks @ 2013-08-14 16:42 UTC (permalink / raw)
  To: linux-arm-kernel

Currently BUG() uses .word or .hword to create the necessary illegal
instructions. However if we are building BE8 then these get swapped
by the linker into different illegal instructions in the text.

Change to using .inst and .inst.w to create the instructions and mark
them as instructions so that the linker acts correctly.

Fixes issue reported by Dave Martin <Dave.Martin@arm.com>

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
---
 arch/arm/include/asm/bug.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/include/asm/bug.h b/arch/arm/include/asm/bug.h
index 7af5c6c..b95da52 100644
--- a/arch/arm/include/asm/bug.h
+++ b/arch/arm/include/asm/bug.h
@@ -12,10 +12,10 @@
  */
 #ifdef CONFIG_THUMB2_KERNEL
 #define BUG_INSTR_VALUE 0xde02
-#define BUG_INSTR_TYPE ".hword "
+#define BUG_INSTR_TYPE ".inst.w "
 #else
 #define BUG_INSTR_VALUE 0xe7f001f2
-#define BUG_INSTR_TYPE ".word "
+#define BUG_INSTR_TYPE ".inst "
 #endif
 
 
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/3] ARM: fix BUG() detection
  2013-08-14 16:42 BE8 patch updates Ben Dooks
  2013-08-14 16:42 ` [PATCH 1/3] ARM: Correct BUG() assembly to ensure it is endian-agnostic Ben Dooks
@ 2013-08-14 16:42 ` Ben Dooks
  2013-08-15 15:09   ` Dave Martin
  2013-08-14 16:42 ` [PATCH 3/3] ARM: kdgb: use <asm/opcodes.h> for data to be assembled as intruction Ben Dooks
  2 siblings, 1 reply; 8+ messages in thread
From: Ben Dooks @ 2013-08-14 16:42 UTC (permalink / raw)
  To: linux-arm-kernel

The detection of the instruction used by BUG() did not take into account
the differences in endian-ness between instruction and data. Change the
code to use the relevant helpers in <asm/opcodes.h> to translate the
endian-ness of the instructions.

Fixes issue reported by Dave Martin <Dave.Martin@arm.com>

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
---
 arch/arm/include/asm/bug.h |   10 ++++++----
 arch/arm/kernel/traps.c    |    8 +++++---
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/arch/arm/include/asm/bug.h b/arch/arm/include/asm/bug.h
index b95da52..b274bde 100644
--- a/arch/arm/include/asm/bug.h
+++ b/arch/arm/include/asm/bug.h
@@ -2,6 +2,8 @@
 #define _ASMARM_BUG_H
 
 #include <linux/linkage.h>
+#include <linux/types.h>
+#include <asm/opcodes.h>
 
 #ifdef CONFIG_BUG
 
@@ -12,10 +14,10 @@
  */
 #ifdef CONFIG_THUMB2_KERNEL
 #define BUG_INSTR_VALUE 0xde02
-#define BUG_INSTR_TYPE ".inst.w "
+#define BUG_INSTR(__value) __inst_thumb16(__value)
 #else
 #define BUG_INSTR_VALUE 0xe7f001f2
-#define BUG_INSTR_TYPE ".inst "
+#define BUG_INSTR(__value) __inst_arm(__value)
 #endif
 
 
@@ -33,7 +35,7 @@
 
 #define __BUG(__file, __line, __value)				\
 do {								\
-	asm volatile("1:\t" BUG_INSTR_TYPE #__value "\n"	\
+	asm volatile("1:\t" BUG_INSTR(__value) "\n"  \
 		".pushsection .rodata.str, \"aMS\", %progbits, 1\n" \
 		"2:\t.asciz " #__file "\n" 			\
 		".popsection\n" 				\
@@ -48,7 +50,7 @@ do {								\
 
 #define __BUG(__file, __line, __value)				\
 do {								\
-	asm volatile(BUG_INSTR_TYPE #__value);			\
+	asm volatile(BUG_INSTR(__value) "\n");			\
 	unreachable();						\
 } while (0)
 #endif  /* CONFIG_DEBUG_BUGVERBOSE */
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index cb67b04..ae2d828 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -344,15 +344,17 @@ void arm_notify_die(const char *str, struct pt_regs *regs,
 int is_valid_bugaddr(unsigned long pc)
 {
 #ifdef CONFIG_THUMB2_KERNEL
-	unsigned short bkpt;
+	u16 bkpt;
+	u16 insn = __opcode_to_mem_thumb16(BUG_INSTR_VALUE);
 #else
-	unsigned long bkpt;
+	u32 bkpt;
+	u32 insn = __opcode_to_mem_arm(BUG_INSTR_VALUE);
 #endif
 
 	if (probe_kernel_address((unsigned *)pc, bkpt))
 		return 0;
 
-	return bkpt == BUG_INSTR_VALUE;
+	return bkpt == insn;
 }
 
 #endif
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/3] ARM: kdgb: use <asm/opcodes.h> for data to be assembled as intruction
  2013-08-14 16:42 BE8 patch updates Ben Dooks
  2013-08-14 16:42 ` [PATCH 1/3] ARM: Correct BUG() assembly to ensure it is endian-agnostic Ben Dooks
  2013-08-14 16:42 ` [PATCH 2/3] ARM: fix BUG() detection Ben Dooks
@ 2013-08-14 16:42 ` Ben Dooks
  2013-08-15 15:53   ` Dave Martin
  2 siblings, 1 reply; 8+ messages in thread
From: Ben Dooks @ 2013-08-14 16:42 UTC (permalink / raw)
  To: linux-arm-kernel

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.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
---
 arch/arm/include/asm/kgdb.h |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/include/asm/kgdb.h b/arch/arm/include/asm/kgdb.h
index 48066ce..0a9d5dd 100644
--- a/arch/arm/include/asm/kgdb.h
+++ b/arch/arm/include/asm/kgdb.h
@@ -11,6 +11,7 @@
 #define __ARM_KGDB_H__
 
 #include <linux/ptrace.h>
+#include <asm/opcodes.h>
 
 /*
  * GDB assumes that we're a user process being debugged, so
@@ -41,7 +42,7 @@
 
 static inline void arch_kgdb_breakpoint(void)
 {
-	asm(".word 0xe7ffdeff");
+	asm(__inst_arm(0xe7ffdeff));
 }
 
 extern void kgdb_handle_bus_error(void);
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/3] ARM: fix BUG() detection
  2013-08-14 16:42 ` [PATCH 2/3] ARM: fix BUG() detection Ben Dooks
@ 2013-08-15 15:09   ` Dave Martin
  2013-08-16  8:31     ` Ben Dooks
  0 siblings, 1 reply; 8+ messages in thread
From: Dave Martin @ 2013-08-15 15:09 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Aug 14, 2013 at 05:42:42PM +0100, Ben Dooks wrote:
> The detection of the instruction used by BUG() did not take into account
> the differences in endian-ness between instruction and data. Change the
> code to use the relevant helpers in <asm/opcodes.h> to translate the
> endian-ness of the instructions.
> 
> Fixes issue reported by Dave Martin <Dave.Martin@arm.com>

It probably makes sense to fold this with the preceding patch.

> 
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
> ---
>  arch/arm/include/asm/bug.h |   10 ++++++----
>  arch/arm/kernel/traps.c    |    8 +++++---
>  2 files changed, 11 insertions(+), 7 deletions(-)
> 
> diff --git a/arch/arm/include/asm/bug.h b/arch/arm/include/asm/bug.h
> index b95da52..b274bde 100644
> --- a/arch/arm/include/asm/bug.h
> +++ b/arch/arm/include/asm/bug.h
> @@ -2,6 +2,8 @@
>  #define _ASMARM_BUG_H
>  
>  #include <linux/linkage.h>
> +#include <linux/types.h>
> +#include <asm/opcodes.h>
>  
>  #ifdef CONFIG_BUG
>  
> @@ -12,10 +14,10 @@
>   */
>  #ifdef CONFIG_THUMB2_KERNEL
>  #define BUG_INSTR_VALUE 0xde02
> -#define BUG_INSTR_TYPE ".inst.w "
> +#define BUG_INSTR(__value) __inst_thumb16(__value)
>  #else
>  #define BUG_INSTR_VALUE 0xe7f001f2
> -#define BUG_INSTR_TYPE ".inst "
> +#define BUG_INSTR(__value) __inst_arm(__value)
>  #endif

Looks OK.  You could make things a bit less verbose by

	#define BUG_INSTR __inst_thumb16(BUG_INSTR_VALUE)
#else
...
	#define BUG_INSTR __inst_arm(BUG_INSTR_VALUE)

>  
>  
> @@ -33,7 +35,7 @@
>  
>  #define __BUG(__file, __line, __value)				\
>  do {								\
> -	asm volatile("1:\t" BUG_INSTR_TYPE #__value "\n"	\
> +	asm volatile("1:\t" BUG_INSTR(__value) "\n"  \
>  		".pushsection .rodata.str, \"aMS\", %progbits, 1\n" \
>  		"2:\t.asciz " #__file "\n" 			\
>  		".popsection\n" 				\
> @@ -48,7 +50,7 @@ do {								\
>  
>  #define __BUG(__file, __line, __value)				\
>  do {								\
> -	asm volatile(BUG_INSTR_TYPE #__value);			\
> +	asm volatile(BUG_INSTR(__value) "\n");			\
>  	unreachable();						\
>  } while (0)
>  #endif  /* CONFIG_DEBUG_BUGVERBOSE */
> diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
> index cb67b04..ae2d828 100644
> --- a/arch/arm/kernel/traps.c
> +++ b/arch/arm/kernel/traps.c
> @@ -344,15 +344,17 @@ void arm_notify_die(const char *str, struct pt_regs *regs,
>  int is_valid_bugaddr(unsigned long pc)
>  {
>  #ifdef CONFIG_THUMB2_KERNEL
> -	unsigned short bkpt;
> +	u16 bkpt;
> +	u16 insn = __opcode_to_mem_thumb16(BUG_INSTR_VALUE);
>  #else
> -	unsigned long bkpt;
> +	u32 bkpt;
> +	u32 insn = __opcode_to_mem_arm(BUG_INSTR_VALUE);
>  #endif
>  
>  	if (probe_kernel_address((unsigned *)pc, bkpt))

Hmm, the (unsigned *) actually looks weird here now I look at it.

probe_kernel_address does (__force typeof(bkpt) __user *) on it anyway,
so I guess that's harmless.  void * might make more sense, though this
patch may not be the place to fix it.

Cheers
---Dave

>  		return 0;
>  
> -	return bkpt == BUG_INSTR_VALUE;
> +	return bkpt == insn;
>  }
>  
>  #endif
> -- 
> 1.7.10.4
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 3/3] ARM: kdgb: use <asm/opcodes.h> for data to be assembled as intruction
  2013-08-14 16:42 ` [PATCH 3/3] ARM: kdgb: use <asm/opcodes.h> for data to be assembled as intruction Ben Dooks
@ 2013-08-15 15:53   ` Dave Martin
  0 siblings, 0 replies; 8+ messages in thread
From: Dave Martin @ 2013-08-15 15:53 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Aug 14, 2013 at 05:42:43PM +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.
> 
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>

Cheers
---Dave

> ---
>  arch/arm/include/asm/kgdb.h |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/include/asm/kgdb.h b/arch/arm/include/asm/kgdb.h
> index 48066ce..0a9d5dd 100644
> --- a/arch/arm/include/asm/kgdb.h
> +++ b/arch/arm/include/asm/kgdb.h
> @@ -11,6 +11,7 @@
>  #define __ARM_KGDB_H__
>  
>  #include <linux/ptrace.h>
> +#include <asm/opcodes.h>
>  
>  /*
>   * GDB assumes that we're a user process being debugged, so
> @@ -41,7 +42,7 @@
>  
>  static inline void arch_kgdb_breakpoint(void)
>  {
> -	asm(".word 0xe7ffdeff");
> +	asm(__inst_arm(0xe7ffdeff));

Actually, the #define could be used directly now:

	__inst_arm(KGDB_COMPILED_BREAK)

I don't know whether KGDB works with THUMB2_KERNEL or not... but this
patch shouldn't break anything that isn't broken already.

Nico and Deepak were involved at some point, maybe they have ideas about
this.  The code in question predates THUMB2_KERNEL and has not been
touched since, but because THUMB2_KERNEL implies !CPU_ENDIAN_BE32, the
first instruction of the asm will be 0xdeff, which is bkpt #0xff.

Other aspects look broken, though.

Maybe it would be wise to make HAVE_ARCH_KGDB conflict with
THUMB2_KERNEL for now.

Cheers
---Dave

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 2/3] ARM: fix BUG() detection
  2013-08-15 15:09   ` Dave Martin
@ 2013-08-16  8:31     ` Ben Dooks
  2013-08-16 13:24       ` Dave Martin
  0 siblings, 1 reply; 8+ messages in thread
From: Ben Dooks @ 2013-08-16  8:31 UTC (permalink / raw)
  To: linux-arm-kernel

On 15/08/13 16:09, Dave Martin wrote:
> On Wed, Aug 14, 2013 at 05:42:42PM +0100, Ben Dooks wrote:
>> The detection of the instruction used by BUG() did not take into account
>> the differences in endian-ness between instruction and data. Change the
>> code to use the relevant helpers in<asm/opcodes.h>  to translate the
>> endian-ness of the instructions.
>>
>> Fixes issue reported by Dave Martin<Dave.Martin@arm.com>
>
> It probably makes sense to fold this with the preceding patch.
>
>>
>> Signed-off-by: Ben Dooks<ben.dooks@codethink.co.uk>
>> ---
>>   arch/arm/include/asm/bug.h |   10 ++++++----
>>   arch/arm/kernel/traps.c    |    8 +++++---
>>   2 files changed, 11 insertions(+), 7 deletions(-)
>>
>> diff --git a/arch/arm/include/asm/bug.h b/arch/arm/include/asm/bug.h
>> index b95da52..b274bde 100644
>> --- a/arch/arm/include/asm/bug.h
>> +++ b/arch/arm/include/asm/bug.h
>> @@ -2,6 +2,8 @@
>>   #define _ASMARM_BUG_H
>>
>>   #include<linux/linkage.h>
>> +#include<linux/types.h>
>> +#include<asm/opcodes.h>
>>
>>   #ifdef CONFIG_BUG
>>
>> @@ -12,10 +14,10 @@
>>    */
>>   #ifdef CONFIG_THUMB2_KERNEL
>>   #define BUG_INSTR_VALUE 0xde02
>> -#define BUG_INSTR_TYPE ".inst.w "
>> +#define BUG_INSTR(__value) __inst_thumb16(__value)
>>   #else
>>   #define BUG_INSTR_VALUE 0xe7f001f2
>> -#define BUG_INSTR_TYPE ".inst "
>> +#define BUG_INSTR(__value) __inst_arm(__value)
>>   #endif
>
> Looks OK.  You could make things a bit less verbose by
>
> 	#define BUG_INSTR __inst_thumb16(BUG_INSTR_VALUE)
> #else
> ...
> 	#define BUG_INSTR __inst_arm(BUG_INSTR_VALUE)

I was trying to keep the macro as similar as possible, although
there is only one bug instruction value at the moment the __BUG()
code seems to assume that in the future there may be more of them
and that it should be able to handle them.

>>
>> @@ -33,7 +35,7 @@
>>
>>   #define __BUG(__file, __line, __value)				\
>>   do {								\
>> -	asm volatile("1:\t" BUG_INSTR_TYPE #__value "\n"	\
>> +	asm volatile("1:\t" BUG_INSTR(__value) "\n"  \
>>   		".pushsection .rodata.str, \"aMS\", %progbits, 1\n" \
>>   		"2:\t.asciz " #__file "\n" 			\
>>   		".popsection\n" 				\
>> @@ -48,7 +50,7 @@ do {								\
>>
>>   #define __BUG(__file, __line, __value)				\
>>   do {								\
>> -	asm volatile(BUG_INSTR_TYPE #__value);			\
>> +	asm volatile(BUG_INSTR(__value) "\n");			\
>>   	unreachable();						\
>>   } while (0)
>>   #endif  /* CONFIG_DEBUG_BUGVERBOSE */
>> diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
>> index cb67b04..ae2d828 100644
>> --- a/arch/arm/kernel/traps.c
>> +++ b/arch/arm/kernel/traps.c
>> @@ -344,15 +344,17 @@ void arm_notify_die(const char *str, struct pt_regs *regs,
>>   int is_valid_bugaddr(unsigned long pc)
>>   {
>>   #ifdef CONFIG_THUMB2_KERNEL
>> -	unsigned short bkpt;
>> +	u16 bkpt;
>> +	u16 insn = __opcode_to_mem_thumb16(BUG_INSTR_VALUE);
>>   #else
>> -	unsigned long bkpt;
>> +	u32 bkpt;
>> +	u32 insn = __opcode_to_mem_arm(BUG_INSTR_VALUE);
>>   #endif
>>
>>   	if (probe_kernel_address((unsigned *)pc, bkpt))
>
> Hmm, the (unsigned *) actually looks weird here now I look at it.
>
> probe_kernel_address does (__force typeof(bkpt) __user *) on it anyway,
> so I guess that's harmless.  void * might make more sense, though this
> patch may not be the place to fix it.
>
> Cheers
> ---Dave
>
>>   		return 0;
>>
>> -	return bkpt == BUG_INSTR_VALUE;
>> +	return bkpt == insn;
>>   }
>>
>>   #endif
>> --
>> 1.7.10.4
>>
>>
>> _______________________________________________
>> linux-arm-kernel mailing list
>> linux-arm-kernel at lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel


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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 2/3] ARM: fix BUG() detection
  2013-08-16  8:31     ` Ben Dooks
@ 2013-08-16 13:24       ` Dave Martin
  0 siblings, 0 replies; 8+ messages in thread
From: Dave Martin @ 2013-08-16 13:24 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Aug 16, 2013 at 09:31:48AM +0100, Ben Dooks wrote:
> On 15/08/13 16:09, Dave Martin wrote:
> >On Wed, Aug 14, 2013 at 05:42:42PM +0100, Ben Dooks wrote:
> >>The detection of the instruction used by BUG() did not take into account
> >>the differences in endian-ness between instruction and data. Change the
> >>code to use the relevant helpers in<asm/opcodes.h>  to translate the
> >>endian-ness of the instructions.
> >>
> >>Fixes issue reported by Dave Martin<Dave.Martin@arm.com>
> >
> >It probably makes sense to fold this with the preceding patch.
> >
> >>
> >>Signed-off-by: Ben Dooks<ben.dooks@codethink.co.uk>
> >>---
> >>  arch/arm/include/asm/bug.h |   10 ++++++----
> >>  arch/arm/kernel/traps.c    |    8 +++++---
> >>  2 files changed, 11 insertions(+), 7 deletions(-)
> >>
> >>diff --git a/arch/arm/include/asm/bug.h b/arch/arm/include/asm/bug.h
> >>index b95da52..b274bde 100644
> >>--- a/arch/arm/include/asm/bug.h
> >>+++ b/arch/arm/include/asm/bug.h
> >>@@ -2,6 +2,8 @@
> >>  #define _ASMARM_BUG_H
> >>
> >>  #include<linux/linkage.h>
> >>+#include<linux/types.h>
> >>+#include<asm/opcodes.h>
> >>
> >>  #ifdef CONFIG_BUG
> >>
> >>@@ -12,10 +14,10 @@
> >>   */
> >>  #ifdef CONFIG_THUMB2_KERNEL
> >>  #define BUG_INSTR_VALUE 0xde02
> >>-#define BUG_INSTR_TYPE ".inst.w "
> >>+#define BUG_INSTR(__value) __inst_thumb16(__value)
> >>  #else
> >>  #define BUG_INSTR_VALUE 0xe7f001f2
> >>-#define BUG_INSTR_TYPE ".inst "
> >>+#define BUG_INSTR(__value) __inst_arm(__value)
> >>  #endif
> >
> >Looks OK.  You could make things a bit less verbose by
> >
> >	#define BUG_INSTR __inst_thumb16(BUG_INSTR_VALUE)
> >#else
> >...
> >	#define BUG_INSTR __inst_arm(BUG_INSTR_VALUE)
> 
> I was trying to keep the macro as similar as possible, although
> there is only one bug instruction value at the moment the __BUG()
> code seems to assume that in the future there may be more of them
> and that it should be able to handle them.

No problem, it should work fine your way.

Cheers
---Dave

> 
> >>
> >>@@ -33,7 +35,7 @@
> >>
> >>  #define __BUG(__file, __line, __value)				\
> >>  do {								\
> >>-	asm volatile("1:\t" BUG_INSTR_TYPE #__value "\n"	\
> >>+	asm volatile("1:\t" BUG_INSTR(__value) "\n"  \
> >>  		".pushsection .rodata.str, \"aMS\", %progbits, 1\n" \
> >>  		"2:\t.asciz " #__file "\n" 			\
> >>  		".popsection\n" 				\
> >>@@ -48,7 +50,7 @@ do {								\
> >>
> >>  #define __BUG(__file, __line, __value)				\
> >>  do {								\
> >>-	asm volatile(BUG_INSTR_TYPE #__value);			\
> >>+	asm volatile(BUG_INSTR(__value) "\n");			\
> >>  	unreachable();						\
> >>  } while (0)
> >>  #endif  /* CONFIG_DEBUG_BUGVERBOSE */
> >>diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
> >>index cb67b04..ae2d828 100644
> >>--- a/arch/arm/kernel/traps.c
> >>+++ b/arch/arm/kernel/traps.c
> >>@@ -344,15 +344,17 @@ void arm_notify_die(const char *str, struct pt_regs *regs,
> >>  int is_valid_bugaddr(unsigned long pc)
> >>  {
> >>  #ifdef CONFIG_THUMB2_KERNEL
> >>-	unsigned short bkpt;
> >>+	u16 bkpt;
> >>+	u16 insn = __opcode_to_mem_thumb16(BUG_INSTR_VALUE);
> >>  #else
> >>-	unsigned long bkpt;
> >>+	u32 bkpt;
> >>+	u32 insn = __opcode_to_mem_arm(BUG_INSTR_VALUE);
> >>  #endif
> >>
> >>  	if (probe_kernel_address((unsigned *)pc, bkpt))
> >
> >Hmm, the (unsigned *) actually looks weird here now I look at it.
> >
> >probe_kernel_address does (__force typeof(bkpt) __user *) on it anyway,
> >so I guess that's harmless.  void * might make more sense, though this
> >patch may not be the place to fix it.
> >
> >Cheers
> >---Dave
> >
> >>  		return 0;
> >>
> >>-	return bkpt == BUG_INSTR_VALUE;
> >>+	return bkpt == insn;
> >>  }
> >>
> >>  #endif
> >>--
> >>1.7.10.4
> >>
> >>
> >>_______________________________________________
> >>linux-arm-kernel mailing list
> >>linux-arm-kernel at lists.infradead.org
> >>http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 
> 
> -- 
> Ben Dooks				http://www.codethink.co.uk/
> Senior Engineer				Codethink - Providing Genius
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-08-16 13:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-14 16:42 BE8 patch updates Ben Dooks
2013-08-14 16:42 ` [PATCH 1/3] ARM: Correct BUG() assembly to ensure it is endian-agnostic Ben Dooks
2013-08-14 16:42 ` [PATCH 2/3] ARM: fix BUG() detection Ben Dooks
2013-08-15 15:09   ` Dave Martin
2013-08-16  8:31     ` Ben Dooks
2013-08-16 13:24       ` Dave Martin
2013-08-14 16:42 ` [PATCH 3/3] ARM: kdgb: use <asm/opcodes.h> for data to be assembled as intruction Ben Dooks
2013-08-15 15:53   ` Dave Martin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.