From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC 02/10] arm: kdump: implement crash_setup_regs()
Date: Mon, 12 Apr 2010 21:01:44 +0100 [thread overview]
Message-ID: <20100412200144.GU3048@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <e3c9449c42a735f9acee8e50af33762ffcadf7b4.1269854500.git.ext-mika.1.westerberg@nokia.com>
On Mon, Mar 29, 2010 at 12:26:28PM +0300, Mika Westerberg wrote:
> Implement machine specific function crash_setup_regs() which is responsible for
> storing machine state when crash occured.
Slightly concerned about this...
> + } else {
> + __asm__ __volatile__("mov %0, r0" : "=r"(newregs->ARM_r0));
> + __asm__ __volatile__("mov %0, r1" : "=r"(newregs->ARM_r1));
> + __asm__ __volatile__("mov %0, r2" : "=r"(newregs->ARM_r2));
> + __asm__ __volatile__("mov %0, r3" : "=r"(newregs->ARM_r3));
> + __asm__ __volatile__("mov %0, r4" : "=r"(newregs->ARM_r4));
> + __asm__ __volatile__("mov %0, r5" : "=r"(newregs->ARM_r5));
> + __asm__ __volatile__("mov %0, r6" : "=r"(newregs->ARM_r6));
> + __asm__ __volatile__("mov %0, r7" : "=r"(newregs->ARM_r7));
> + __asm__ __volatile__("mov %0, r8" : "=r"(newregs->ARM_r8));
> + __asm__ __volatile__("mov %0, r9" : "=r"(newregs->ARM_r9));
> + __asm__ __volatile__("mov %0, r10" : "=r"(newregs->ARM_r10));
> + __asm__ __volatile__("mov %0, r11" : "=r"(newregs->ARM_fp));
> + __asm__ __volatile__("mov %0, r12" : "=r"(newregs->ARM_ip));
> + __asm__ __volatile__("mov %0, r13" : "=r"(newregs->ARM_sp));
> + __asm__ __volatile__("mov %0, r14" : "=r"(newregs->ARM_lr));
> + __asm__ __volatile__("mov %0, r15" : "=r"(newregs->ARM_pc));
> + __asm__ __volatile__("mrs %0, cpsr" : "=r"(newregs->ARM_cpsr));
How is whatever follows on supposed to work back from this state? It's
entirely possible that the compiler will generate a load of asm between
each __asm__ statement corrupting the registers - and you can't save
all this state without having one register storing the 'newregs'
pointer.
It'd probably be better to do something like:
__asm__ __volatile__("stmia %0, {r0 - r15}" : : "r" (&newregs->ARM_r0));
__asm__ __volatile__("mrs %0, cpsr" : "=r" (newregs->ARM_cpsr));
instead, which should mean only one register is (potentially) corrupted.
However, I still think you're going to have problems knowing what's in
each register.
next prev parent reply other threads:[~2010-04-12 20:01 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-29 9:26 [RFC 00/10] Initial implementation of kdump for ARM Mika Westerberg
2010-03-29 9:26 ` [RFC 01/10] arm: kdump: reserve memory for crashkernel Mika Westerberg
2010-03-29 9:26 ` [RFC 02/10] arm: kdump: implement crash_setup_regs() Mika Westerberg
2010-03-29 9:26 ` [RFC 03/10] arm: kdump: implement machine_crash_shutdown() Mika Westerberg
2010-03-29 9:26 ` [RFC 04/10] arm: kdump: skip indirection page when crashing Mika Westerberg
2010-03-29 9:26 ` [RFC 05/10] arm: kdump: make kexec work in interrupt context Mika Westerberg
2010-03-29 9:26 ` [RFC 06/10] arm: kdump: implement copy_oldmem_page() Mika Westerberg
2010-03-29 9:26 ` [RFC 07/10] arm: allow passing an ELF64 header to elf_check_arch() Mika Westerberg
2010-03-29 9:26 ` [RFC 08/10] arm: kdump: add support for elfcorehdr= parameter Mika Westerberg
2010-03-29 9:26 ` [RFC 09/10] arm: implement reserve memory early parameter Mika Westerberg
2010-03-29 9:26 ` [RFC 10/10] arm: kdump: add CONFIG_CRASH_DUMP Kconfig option Mika Westerberg
2010-04-12 21:05 ` [RFC 09/10] arm: implement reserve memory early parameter Russell King - ARM Linux
2010-04-13 6:37 ` Mika Westerberg
2010-04-15 12:40 ` Mika Westerberg
2010-03-29 21:12 ` [RFC 07/10] arm: allow passing an ELF64 header to elf_check_arch() Russell King - ARM Linux
2010-03-30 7:11 ` Mika Westerberg
2010-03-29 23:41 ` Jamie Lokier
2010-03-30 7:26 ` Mika Westerberg
2010-03-30 11:41 ` Jamie Lokier
2010-04-12 20:03 ` [RFC 05/10] arm: kdump: make kexec work in interrupt context Russell King - ARM Linux
2010-04-12 20:01 ` Russell King - ARM Linux [this message]
2010-04-13 5:53 ` [RFC 02/10] arm: kdump: implement crash_setup_regs() Mika Westerberg
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=20100412200144.GU3048@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--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).