mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Antony Pavlov <antonynpavlov@gmail.com>
To: barebox@lists.infradead.org
Subject: [RFC 1/3] MIPS: introduce C architecture-specific low-level init
Date: Mon, 21 May 2012 12:07:09 +0400	[thread overview]
Message-ID: <1337587631-16650-2-git-send-email-antonynpavlov@gmail.com> (raw)
In-Reply-To: <1337587631-16650-1-git-send-email-antonynpavlov@gmail.com>

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
---
 arch/mips/boot/Makefile     |    1 +
 arch/mips/boot/main_entry.c |   45 +++++++++++++++++++++++++++++++++++++++++++
 arch/mips/boot/start.S      |   14 ++------------
 3 files changed, 48 insertions(+), 12 deletions(-)
 create mode 100644 arch/mips/boot/main_entry.c

diff --git a/arch/mips/boot/Makefile b/arch/mips/boot/Makefile
index f9151d2..d6d28ce 100644
--- a/arch/mips/boot/Makefile
+++ b/arch/mips/boot/Makefile
@@ -1 +1,2 @@
 obj-y += start.o
+obj-y += main_entry.o
diff --git a/arch/mips/boot/main_entry.c b/arch/mips/boot/main_entry.c
new file mode 100644
index 0000000..fa072de
--- /dev/null
+++ b/arch/mips/boot/main_entry.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2009 Juergen Beisert, Pengutronix
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ */
+
+/**
+ * @file
+ * @brief Start of the 32 bit flat mode
+ */
+
+#include <common.h>
+#include <string.h>
+#include <asm/sections.h>
+
+extern void start_barebox(void);
+
+void main_entry(void);
+
+/**
+ * Called plainly from assembler that switches from real to flat mode
+ *
+ * @note The C environment isn't initialized yet
+ */
+void main_entry(void)
+{
+	/* clear the BSS first */
+	memset(__bss_start, 0x00, __bss_stop - __bss_start);
+
+	start_barebox();
+}
diff --git a/arch/mips/boot/start.S b/arch/mips/boot/start.S
index e8868e1..dd302fc 100644
--- a/arch/mips/boot/start.S
+++ b/arch/mips/boot/start.S
@@ -79,7 +79,7 @@ __start:
 
 	la	a1, _start	/* link (RAM) _start address */
 
-	beq	a0, a1, clear_bss
+	beq	a0, a1, stack_setup
 	 nop
 
 	la	t0, _start
@@ -105,16 +105,6 @@ copy_loop:
 	blez		t3, copy_loop
 	addi		a1, LONGSIZE * 4
 
-clear_bss:
-	la	t0, __bss_start
-	sw	zero, (t0)
-	la	t1, _end - 4
-1:
-	addiu	t0, LONGSIZE
-	sw	zero, (t0)
-	bne	t0, t1, 1b
-	 nop
-
 	/*
 	 * Dominic Sweetman, See MIPS Run, Morgan Kaufmann, 2nd edition, 2006
 	 *
@@ -144,7 +134,7 @@ stack_setup:
 	/* reserve four 32-bit argument slots */
 	addiu	sp, -16
 
-	la	v0, start_barebox
+	la	v0, main_entry
 	jal     v0
 	 nop
 
-- 
1.7.10


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2012-05-21  8:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-21  8:07 [RFC 0/3] MIPS: import CPU and cache detection code from Linux Antony Pavlov
2012-05-21  8:07 ` Antony Pavlov [this message]
2012-05-22  9:29   ` [RFC 1/3] MIPS: introduce C architecture-specific low-level init Jean-Christophe PLAGNIOL-VILLARD
2012-05-21  8:07 ` [RFC 2/3] MIPS: import CPU and cache detection code from Linux Antony Pavlov
2012-05-21  8:07 ` [RFC 3/3] MIPS: cpuinfo: import CPU message " Antony Pavlov
2012-05-21 19:46 ` [RFC 0/3] MIPS: import CPU and cache detection code " Sascha Hauer
2012-05-22  9:31 ` Jean-Christophe PLAGNIOL-VILLARD

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=1337587631-16650-2-git-send-email-antonynpavlov@gmail.com \
    --to=antonynpavlov@gmail.com \
    --cc=barebox@lists.infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox