diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-02-03 10:18:11 +0100 |
---|---|---|
committer | Michael Tokarev <mjt@tls.msk.ru> | 2014-02-15 16:10:25 +0400 |
commit | c1570e2a1fd7ff6bc8d7b0c6104bed77283f89a7 (patch) | |
tree | f797672c0764bccafb2925bedeef597f52ea3da7 /hw/sparc/leon3.c | |
parent | a63e5e0c0d457718a957c351c996ba9cb31d5cdd (diff) | |
download | qemu-c1570e2a1fd7ff6bc8d7b0c6104bed77283f89a7.zip qemu-c1570e2a1fd7ff6bc8d7b0c6104bed77283f89a7.tar.gz qemu-c1570e2a1fd7ff6bc8d7b0c6104bed77283f89a7.tar.bz2 |
sparc/leon3: Initialize stack pointer
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>
Reviewed-by: Fabien Chouteau <chouteau@adacore.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Diffstat (limited to 'hw/sparc/leon3.c')
-rw-r--r-- | 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 */ |