Received: from eggs.gnu.org ([2001:4830:134:3::10]:49047) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WEeIa-0007PM-UO for qemu-devel@nongnu.org; Sat, 15 Feb 2014 07:24:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WEeIW-0000ZL-Td for qemu-devel@nongnu.org; Sat, 15 Feb 2014 07:24:48 -0500 From: Michael Tokarev Date: Sat, 15 Feb 2014 16:18:12 +0400 Message-Id: <1392466700-21770-3-git-send-email-mjt@msgid.tls.msk.ru> In-Reply-To: <1392466700-21770-1-git-send-email-mjt@msgid.tls.msk.ru> References: <1392466700-21770-1-git-send-email-mjt@msgid.tls.msk.ru> Subject: [Qemu-devel] [PULL 02/10] sparc/leon3: Initialize stack pointer List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org, Sebastian Huber , Michael Tokarev From: Sebastian Huber 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 Reviewed-by: Fabien Chouteau Signed-off-by: Michael Tokarev --- hw/sparc/leon3.c | 3 +++ 1 file changed, 3 insertions(+) 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.10.4