From: long.wanglong@huawei.com (Wang Long)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: avoid corrupts register in mcaro kputc kphex etc.
Date: Wed, 20 Aug 2014 17:50:02 +0800 [thread overview]
Message-ID: <1408528202-152139-1-git-send-email-long.wanglong@huawei.com> (raw)
when use macro 'kputc' kphex' to print the content of
register r0-r3, they will corrupts these registers.
the same as the macro 'debug_reloc_start' and 'debug_reloc_end'.
so using 'push' when enter the macro and 'pop' when leave
the macro to fix it.
Signed-off-by: Wang Long <long.wanglong@huawei.com>
---
arch/arm/boot/compressed/head.S | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index 413fd94..aa57a09 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -19,6 +19,7 @@
* 100% relocatable. Any attempt to do so will result in a crash.
* Please select one of the following when turning on debugging.
*/
+#define DEBUG
#ifdef DEBUG
#if defined(CONFIG_DEBUG_ICEDCC)
@@ -69,18 +70,23 @@
#endif
.macro kputc,val
+ push {r0-r3}
mov r0, \val
bl putc
+ pop {r0-r3}
.endm
.macro kphex,val,len
+ push {r0-r3}
mov r0, \val
mov r1, #\len
bl phex
+ pop {r0-r3}
.endm
.macro debug_reloc_start
#ifdef DEBUG
+ push {r0-r3}
kputc #'\n'
kphex r6, 8 /* processor id */
kputc #':'
@@ -97,15 +103,18 @@
kputc #'>'
kphex r4, 8 /* kernel execution address */
kputc #'\n'
+ pop {r0-r3}
#endif
.endm
.macro debug_reloc_end
#ifdef DEBUG
+ push {r0-r3,r10-r12}
kphex r5, 8 /* end of kernel */
kputc #'\n'
mov r0, r4
bl memdump /* dump 256 bytes at start of kernel */
+ pop {r0-r3,r10-r12}
#endif
.endm
--
1.8.3.4
next reply other threads:[~2014-08-20 9:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-20 9:50 Wang Long [this message]
2014-08-20 10:01 ` [PATCH] ARM: avoid corrupts register in mcaro kputc kphex etc Russell King - ARM Linux
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1408528202-152139-1-git-send-email-long.wanglong@huawei.com \
--to=long.wanglong@huawei.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).