From: Carlo Caione <carlo.caione@gmail.com>
To: barebox@lists.infradead.org
Subject: SVC32 and SP
Date: Fri, 18 May 2012 00:06:00 +0200 [thread overview]
Message-ID: <CAOQ7t2aPsARo+NTNDobCAUVjhRR4TE9X7-L5m8xqMo4+R6oNOA@mail.gmail.com> (raw)
Hi,
I was debugging the problem with barebox and qemu-linaro as I
described in a previous post.
This is what I have discovered.
The problem is in the strlen function that seems to get corrupted
runtime during barebox initialization. The problem seems related to
the switch to SVC32 mode together with the __mmu_cache_flush
implementation.
Before setting the cpu to SVC32 mode, the Stack Pointer is correctly
set to 0x4020fcb0, but, immediately after the writing in the cpsr
register (__asm__ __volatile__("msr cpsr, %0" : : "r"(r));) the Stack
Pointer (now R13_SVC) is in 0x40205cb0 that is in the middle of the
.text section (and precisely in the middle of the strlen routine).
The problem is that in the __mmu_cache_flush disassembly I have a huge
push {r0, r1, r2, r3, r4, r5, r6, r7, r9, r10, r11} that overwrites
the strlen function and corrupts the code.
I'm using:
arm-none-eabi-gcc (Sourcery CodeBench Lite 2011.09-69) 4.6.1
QEMU emulator version 1.0.91 (qemu-linaro from git)
--
Carlo Caione
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next reply other threads:[~2012-05-17 22:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-17 22:06 Carlo Caione [this message]
2012-05-18 9:41 ` Sascha Hauer
2012-05-21 19:31 ` Carlo Caione
2012-05-21 19:37 ` Sascha Hauer
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=CAOQ7t2aPsARo+NTNDobCAUVjhRR4TE9X7-L5m8xqMo4+R6oNOA@mail.gmail.com \
--to=carlo.caione@gmail.com \
--cc=barebox@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