From patchwork Mon Feb 3 09:18:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Huber X-Patchwork-Id: 316084 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id ABEE32C0092 for ; Mon, 3 Feb 2014 20:18:44 +1100 (EST) Received: from localhost ([::1]:45013 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WAFfu-0002rn-8v for incoming@patchwork.ozlabs.org; Mon, 03 Feb 2014 04:18:42 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34620) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WAFfY-0002ra-KT for qemu-devel@nongnu.org; Mon, 03 Feb 2014 04:18:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WAFfT-0007GV-MS for qemu-devel@nongnu.org; Mon, 03 Feb 2014 04:18:20 -0500 Received: from host-82-135-62-35.customer.m-online.net ([82.135.62.35]:44312 helo=mail.embedded-brains.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WAFfT-0007GM-EC; Mon, 03 Feb 2014 04:18:15 -0500 Received: by mail.embedded-brains.de (Postfix, from userid 65534) id 0AD7F652CFD; Mon, 3 Feb 2014 10:18:13 +0100 (CET) Received: from linux-7i4a.eb.z (unknown [192.168.100.11]) by mail.embedded-brains.de (Postfix) with ESMTP id 686D4652CF6; Mon, 3 Feb 2014 10:18:13 +0100 (CET) From: Sebastian Huber To: qemu-devel@nongnu.org Date: Mon, 3 Feb 2014 10:18:11 +0100 Message-Id: <1391419091-3020-1-git-send-email-sebastian.huber@embedded-brains.de> X-Mailer: git-send-email 1.7.7 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 82.135.62.35 Cc: qemu-trivial@nongnu.org, Sebastian Huber , Fabien Chouteau Subject: [Qemu-devel] [PATCH] sparc/leon3: Initialize stack pointer X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- 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 */