summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Pitre <nicolas.pitre@linaro.org>2017-09-17 23:04:47 -0400
committerNicolas Pitre <nicolas.pitre@linaro.org>2017-09-19 17:28:23 -0400
commit07e9febcfb1c51664cc04eefee1d2213b221e547 (patch)
tree8e01f307650b80d3a5a785f5ab5666e37a9540c3
parent569dbb88e80deb68974ef6fdd6a13edb9d686261 (diff)
downloadlinux-07e9febcfb1c51664cc04eefee1d2213b221e547.tar.gz
ARM: 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>
-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 ea9646c..423f443 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 )