summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Pitre <nicolas.pitre@linaro.org>2017-10-06 19:36:58 +0100
committerRussell King <rmk+kernel@armlinux.org.uk>2017-10-12 11:26:21 +0100
commite11d1314d83ec7f562fa01df29878d0b1138cf00 (patch)
tree5e31a1b9ccdc1bacdbbe06b097e5963ab1429c4c
parentc772568788b5f0cbaac7c8d4111d7173bfc90673 (diff)
downloadlinux-e11d1314d83ec7f562fa01df29878d0b1138cf00.tar.gz
linux-e11d1314d83ec7f562fa01df29878d0b1138cf00.tar.bz2
linux-e11d1314d83ec7f562fa01df29878d0b1138cf00.zip
ARM: 8703/1: debug.S: move hexbuf to a writable section
This was located in .text which is meant to be read-only. And in the XIP case this shortcut simply doesn't work and may trigger a Flash controller mode switch and crash the kernel. Move it to the .bss area. Signed-off-by: Nicolas Pitre <nico@linaro.org> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
-rw-r--r--arch/arm/kernel/debug.S14
1 files changed, 11 insertions, 3 deletions
diff --git a/arch/arm/kernel/debug.S b/arch/arm/kernel/debug.S
index ea9646cc2a0e..423f4432586d 100644
--- a/arch/arm/kernel/debug.S
+++ b/arch/arm/kernel/debug.S
@@ -55,7 +55,9 @@ ENDPROC(printhex4)
ENTRY(printhex2)
mov r1, #2
-printhex: adr r2, hexbuf
+printhex: adr r2, hexbuf_rel
+ ldr r3, [r2]
+ add r2, r2, r3
add r3, r2, r1
mov r1, #0
strb r1, [r3]
@@ -71,7 +73,11 @@ printhex: adr r2, hexbuf
b printascii
ENDPROC(printhex2)
-hexbuf: .space 16
+ .pushsection .bss
+hexbuf_addr: .space 16
+ .popsection
+ .align
+hexbuf_rel: .long hexbuf_addr - .
.ltorg
@@ -120,7 +126,9 @@ ENTRY(printascii)
ENDPROC(printascii)
ENTRY(printch)
- adr r1, hexbuf
+ adr r1, hexbuf_rel
+ ldr r2, [r1]
+ add r1, r1, r2
strb r0, [r1]
mov r0, #0x03 @ SYS_WRITEC
ARM( svc #0x123456 )