Browse Source

ARM: 8704/1: semihosting: use proper instruction on v7m processors

The svc instruction doesn't exist on v7m processors. Semihosting ops are
invoked with the bkpt instruction instead.

Signed-off-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Nicolas Pitre 7 years ago
parent
commit
ee3eaee6a1
2 changed files with 12 additions and 0 deletions
  1. 4 0
      arch/arm/boot/compressed/debug.S
  2. 8 0
      arch/arm/kernel/debug.S

+ 4 - 0
arch/arm/boot/compressed/debug.S

@@ -23,7 +23,11 @@ ENTRY(putc)
 	strb	r0, [r1]
 	strb	r0, [r1]
 	mov	r0, #0x03		@ SYS_WRITEC
 	mov	r0, #0x03		@ SYS_WRITEC
    ARM(	svc	#0x123456	)
    ARM(	svc	#0x123456	)
+#ifdef CONFIG_CPU_V7M
+ THUMB(	bkpt	#0xab		)
+#else
  THUMB(	svc	#0xab		)
  THUMB(	svc	#0xab		)
+#endif
 	mov	pc, lr
 	mov	pc, lr
 	.align	2
 	.align	2
 1:	.word	_GLOBAL_OFFSET_TABLE_ - .
 1:	.word	_GLOBAL_OFFSET_TABLE_ - .

+ 8 - 0
arch/arm/kernel/debug.S

@@ -115,7 +115,11 @@ ENTRY(printascii)
 		mov	r1, r0
 		mov	r1, r0
 		mov	r0, #0x04		@ SYS_WRITE0
 		mov	r0, #0x04		@ SYS_WRITE0
 	ARM(	svc	#0x123456	)
 	ARM(	svc	#0x123456	)
+#ifdef CONFIG_CPU_V7M
+	THUMB(	bkpt	#0xab		)
+#else
 	THUMB(	svc	#0xab		)
 	THUMB(	svc	#0xab		)
+#endif
 		ret	lr
 		ret	lr
 ENDPROC(printascii)
 ENDPROC(printascii)
 
 
@@ -124,7 +128,11 @@ ENTRY(printch)
 		strb	r0, [r1]
 		strb	r0, [r1]
 		mov	r0, #0x03		@ SYS_WRITEC
 		mov	r0, #0x03		@ SYS_WRITEC
 	ARM(	svc	#0x123456	)
 	ARM(	svc	#0x123456	)
+#ifdef CONFIG_CPU_V7M
+	THUMB(	bkpt	#0xab		)
+#else
 	THUMB(	svc	#0xab		)
 	THUMB(	svc	#0xab		)
+#endif
 		ret	lr
 		ret	lr
 ENDPROC(printch)
 ENDPROC(printch)