All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 4/9] MIPS: factor out code for initial stack and global data
Date: Sun, 25 Sep 2016 20:05:27 +0200	[thread overview]
Message-ID: <20160925180532.19800-5-daniel.schwierzeck@gmail.com> (raw)
In-Reply-To: <20160925180532.19800-1-daniel.schwierzeck@gmail.com>

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 <daniel.schwierzeck@gmail.com>
---

 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
-- 
2.9.3

  parent reply	other threads:[~2016-09-25 18:05 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-25 18:05 [U-Boot] [PATCH 0/9] MIPS: improve start.S and add exception support Daniel Schwierzeck
2016-09-25 18:05 ` [U-Boot] [PATCH 1/9] MIPS: make inclusion of ROM exception vectors configurable Daniel Schwierzeck
2016-09-25 18:05 ` [U-Boot] [PATCH 2/9] MIPS: fix ROM exception vectors Daniel Schwierzeck
2016-09-26  7:58   ` Matthew Fortune
2016-09-26 17:45     ` Daniel Schwierzeck
2016-09-26 19:03       ` Matthew Fortune
2016-09-25 18:05 ` [U-Boot] [PATCH 3/9] MIPS: fix iand optimize setup of CP0 registers Daniel Schwierzeck
2016-09-25 18:05 ` Daniel Schwierzeck [this message]
2016-09-25 18:05 ` [U-Boot] [PATCH 5/9] MIPS: add possibility to setup initial stack and global data in SRAM Daniel Schwierzeck
2016-09-25 18:05 ` [U-Boot] [PATCH 6/9] MIPS: add asm-offsets for struct pt_regs Daniel Schwierzeck
2016-09-25 18:05 ` [U-Boot] [PATCH 7/9] MIPS: reserve space for exception vectors Daniel Schwierzeck
2016-09-25 18:05 ` [U-Boot] [PATCH 8/9] MIPS: add handling for generic and EJTAG exceptions Daniel Schwierzeck
2016-09-26 10:29   ` Paul Burton
2016-09-26 17:41     ` Daniel Schwierzeck
2016-09-26 18:15       ` Paul Burton
2016-09-25 18:05 ` [U-Boot] [PATCH 9/9] common/board_f: enable initr_trap for MIPS Daniel Schwierzeck
2016-09-27  0:34   ` Simon Glass
2016-09-26  7:52 ` [U-Boot] [PATCH 0/9] MIPS: improve start.S and add exception support Matthew Fortune

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160925180532.19800-5-daniel.schwierzeck@gmail.com \
    --to=daniel.schwierzeck@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.