linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: AT91: How copy kernel code to SRAM and execute?
Date: Sun, 26 Feb 2012 17:50:37 +0000	[thread overview]
Message-ID: <20120226175037.GA4706@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <4F4A6DD5.5040606@emagii.com>

On Sun, Feb 26, 2012 at 06:37:25PM +0100, ARM Linux wrote:
> I am looking for some examples on how to copy a small piece of kernel code
> to internal SRAM and then execute it.

See fncpy.h

> Note that when arch_reset is called, the CPU is no longer executing
> in its normal state.
> It is called from arm_machine_restart in "arch/arm/kernel/process.c"
> which has turned off the caches and setup some direct mapping at lower  
> addresses

You're looking at old kernel code.  Stuff has substantially changed in
this area, and CPU caches are no longer turned off if we're going to do
a hardware based reset.

However, that doesn't negate what you're trying to do, and you'll need
to use fncpy() for portability.

The code which you want to copy must be written carefully in assembly
language, and must be written to be relocatable.

  reply	other threads:[~2012-02-26 17:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-26 17:37 AT91: How copy kernel code to SRAM and execute? ARM Linux
2012-02-26 17:50 ` Russell King - ARM Linux [this message]
2012-02-26 20:48   ` Ulf Samuelsson
2012-02-26 21:05     ` Russell King - ARM Linux
2012-02-27  3:42       ` Jean-Christophe PLAGNIOL-VILLARD
2012-02-26 18:44 ` Jean-Christophe PLAGNIOL-VILLARD
2012-02-26 20:52   ` ARM Linux
2012-02-27  3:40     ` Jean-Christophe PLAGNIOL-VILLARD

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=20120226175037.GA4706@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).