From: Sebastian Huber <sebastian.huber@embedded-brains.de>
To: qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org,
Sebastian Huber <sebastian.huber@embedded-brains.de>,
Fabien Chouteau <chouteau@adacore.com>
Subject: [Qemu-devel] [PATCH] sparc/leon3: Initialize stack pointer
Date: Mon, 3 Feb 2014 10:18:11 +0100 [thread overview]
Message-ID: <1391419091-3020-1-git-send-email-sebastian.huber@embedded-brains.de> (raw)
A lot of real world LEON3 systems are shipped with the GRMON boot
loader. This boot loader initializes the stack pointer with the end of
RAM address. The application can use this to detect the RAM size of a
particular board variant.
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
---
hw/sparc/leon3.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/hw/sparc/leon3.c b/hw/sparc/leon3.c
index c583c3d..c16e9e4 100644
--- a/hw/sparc/leon3.c
+++ b/hw/sparc/leon3.c
@@ -45,6 +45,7 @@
typedef struct ResetData {
SPARCCPU *cpu;
uint32_t entry; /* save kernel entry in case of reset */
+ target_ulong sp; /* initial stack pointer */
} ResetData;
static void main_cpu_reset(void *opaque)
@@ -58,6 +59,7 @@ static void main_cpu_reset(void *opaque)
cpu->halted = 0;
env->pc = s->entry;
env->npc = s->entry + 4;
+ env->regbase[6] = s->sp;
}
void leon3_irq_ack(void *irq_manager, int intno)
@@ -133,6 +135,7 @@ static void leon3_generic_hw_init(QEMUMachineInitArgs *args)
/* Reset data */
reset_info = g_malloc0(sizeof(ResetData));
reset_info->cpu = cpu;
+ reset_info->sp = 0x40000000 + ram_size;
qemu_register_reset(main_cpu_reset, reset_info);
/* Allocate IRQ manager */
--
1.7.7
next reply other threads:[~2014-02-03 9:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-03 9:18 Sebastian Huber [this message]
2014-02-05 9:02 ` [Qemu-devel] [PATCH] sparc/leon3: Initialize stack pointer Fabien Chouteau
2014-02-05 9:26 ` [Qemu-devel] [Qemu-trivial] " Fabien Chouteau
2014-02-06 8:40 ` Michael Tokarev
2014-02-06 8:52 ` Sebastian Huber
2014-02-06 8:57 ` Peter Maydell
2014-02-12 13:54 ` Sebastian Huber
2014-02-12 14:00 ` Peter Maydell
2014-02-12 16:27 ` Michael Tokarev
2014-02-12 16:40 ` Andreas Färber
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=1391419091-3020-1-git-send-email-sebastian.huber@embedded-brains.de \
--to=sebastian.huber@embedded-brains.de \
--cc=chouteau@adacore.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.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).