From patchwork Sun Sep 25 18:05:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Schwierzeck X-Patchwork-Id: 674643 X-Patchwork-Delegate: daniel.schwierzeck@googlemail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3shw5k2ND0z9s65 for ; Mon, 26 Sep 2016 04:06:34 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=W+Hn2Ot6; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9616DA7613; Sun, 25 Sep 2016 20:06:20 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yMGB_jgzIgJ4; Sun, 25 Sep 2016 20:06:20 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9DC9CA767E; Sun, 25 Sep 2016 20:06:05 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DE390A75D2 for ; Sun, 25 Sep 2016 20:05:57 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xW3LZMhTGpa8 for ; Sun, 25 Sep 2016 20:05:57 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by theia.denx.de (Postfix) with ESMTPS id 91F51A7550 for ; Sun, 25 Sep 2016 20:05:57 +0200 (CEST) Received: by mail-wm0-f67.google.com with SMTP id 133so10789618wmq.2 for ; Sun, 25 Sep 2016 11:05:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=YcGOFKeZspgjPgImqu0li2sQLITNqhcz2PM8kXw1Jzs=; b=W+Hn2Ot6dI7Txr/M4cMUBU6LaDhzWO8ARzZQTotQjKEM6JjdZHcWfVNg7TUR8eMtKv 5SJDkvVpz4FWHkTzrh7FhPMOuWIJt4M8fiBmzs6m6T70ze5U3NyoeuZID5r5SM9yk93z qqSeVTVJVpbNNNq7K7K0rugG8fCwMwZXvM+dj/8961Y5+0lV+PHAhLSUpKzDzFHwRL09 ZjjYS87AeMpUXpqQFqyx99Wa0q9K/7VmcpFA221CFMHUyYHtg35n2TAgJWlLF7LGuzq6 heVFt5opTQFL5qi0z5nbIhKGhmhpm4evnc2QdChi0ZD2m6QEZ09lmJLPqLv0fdr0oMEX zjOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=YcGOFKeZspgjPgImqu0li2sQLITNqhcz2PM8kXw1Jzs=; b=fX5dZPO9A8k644k4cbjKTAhHXNP8wewf5aNxzaJSkDdgwfoH8TjNoSwryutCvjA36C WK0uwKo405pC1B7dHaXMmKzvuug2Y8DjB7WiRmT0KSumchNqPX8sfM68lAu1i9qhbQaz kaYzEPDoYiZgOfEcDBHj/AjArKHwmbn/CINo4QpmhsLc9JR4fzwWfxZ+efIjzvYkpx2k nINX+Vn32eXx5y/sSw6SAUso10VniDAyjS9CKspO5kA1QVdIpLP8Me1cC8WUINXY8WOS bK41UDEp1hTSG3JMIhaK/v+ebGhZue/Qxmhswz1uPGd/yzPiRq8+71GHNSCxJnuhiwxL 8LSA== X-Gm-Message-State: AA6/9RmiISb4k+RkIhNDEfGLxcWah0iz/ydnQAe2e1zkYhS0lTHzggaZKKt6QBFgTnbEiw== X-Received: by 10.28.155.212 with SMTP id d203mr11551889wme.103.1474826757165; Sun, 25 Sep 2016 11:05:57 -0700 (PDT) Received: from workstation.zombienet.local (p2003005F2C23240162A44CFFFE5E9229.dip0.t-ipconnect.de. [2003:5f:2c23:2401:62a4:4cff:fe5e:9229]) by smtp.gmail.com with ESMTPSA id p13sm7042758wmd.1.2016.09.25.11.05.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 25 Sep 2016 11:05:56 -0700 (PDT) From: Daniel Schwierzeck To: u-boot@lists.denx.de Date: Sun, 25 Sep 2016 20:05:27 +0200 Message-Id: <20160925180532.19800-5-daniel.schwierzeck@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20160925180532.19800-1-daniel.schwierzeck@gmail.com> References: <20160925180532.19800-1-daniel.schwierzeck@gmail.com> Cc: Marek Vasut , Purna Chandra Mandal , Wills Wang Subject: [U-Boot] [PATCH 4/9] MIPS: factor out code for initial stack and global data X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Move the code for setting up the initial stack and global data to a macro to be able to use it more than once. Signed-off-by: Daniel Schwierzeck --- arch/mips/cpu/start.S | 56 +++++++++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/arch/mips/cpu/start.S b/arch/mips/cpu/start.S index c909ffa..ee9de99 100644 --- a/arch/mips/cpu/start.S +++ b/arch/mips/cpu/start.S @@ -44,6 +44,34 @@ nop .endm + .macro setup_stack_gd + li t0, -16 + PTR_LI t1, CONFIG_SYS_INIT_SP_ADDR + and sp, t1, t0 # force 16 byte alignment + PTR_SUBU \ + sp, sp, GD_SIZE # reserve space for gd + and sp, sp, t0 # force 16 byte alignment + move k0, sp # save gd pointer +#ifdef CONFIG_SYS_MALLOC_F_LEN + li t2, CONFIG_SYS_MALLOC_F_LEN + PTR_SUBU \ + sp, sp, t2 # reserve space for early malloc + and sp, sp, t0 # force 16 byte alignment +#endif + move fp, sp + + /* Clear gd */ + move t0, k0 +1: + PTR_S zero, 0(t0) + blt t0, t1, 1b + PTR_ADDIU t0, PTRSIZE + +#ifdef CONFIG_SYS_MALLOC_F_LEN + PTR_S sp, GD_MALLOC_BASE(k0) # gd->malloc_base offset +#endif + .endm + ENTRY(_start) /* U-Boot entry point */ b reset @@ -219,32 +247,8 @@ wr_done: # endif #endif - /* Set up temporary stack */ - li t0, -16 - PTR_LI t1, CONFIG_SYS_INIT_SP_ADDR - and sp, t1, t0 # force 16 byte alignment - PTR_SUBU \ - sp, sp, GD_SIZE # reserve space for gd - and sp, sp, t0 # force 16 byte alignment - move k0, sp # save gd pointer -#ifdef CONFIG_SYS_MALLOC_F_LEN - li t2, CONFIG_SYS_MALLOC_F_LEN - PTR_SUBU \ - sp, sp, t2 # reserve space for early malloc - and sp, sp, t0 # force 16 byte alignment -#endif - move fp, sp - - /* Clear gd */ - move t0, k0 -1: - PTR_S zero, 0(t0) - blt t0, t1, 1b - PTR_ADDIU t0, PTRSIZE - -#ifdef CONFIG_SYS_MALLOC_F_LEN - PTR_S sp, GD_MALLOC_BASE(k0) # gd->malloc_base offset -#endif + /* Set up initial stack and global data */ + setup_stack_gd move a0, zero # a0 <-- boot_flags = 0 PTR_LA t9, board_init_f