qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] sparc/leon3: Initialize stack pointer
@ 2014-02-03  9:18 Sebastian Huber
  2014-02-05  9:02 ` Fabien Chouteau
  2014-02-06  8:40 ` Michael Tokarev
  0 siblings, 2 replies; 10+ messages in thread
From: Sebastian Huber @ 2014-02-03  9:18 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Sebastian Huber, Fabien Chouteau

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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2014-02-12 16:40 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-03  9:18 [Qemu-devel] [PATCH] sparc/leon3: Initialize stack pointer Sebastian Huber
2014-02-05  9:02 ` 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

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).