From 6a1e9a7c9b384d80c6977f2a1d5682a4e9e39de1 Mon Sep 17 00:00:00 2001 From: Antony Pavlov Date: Tue, 22 May 2012 16:16:59 +0400 Subject: MIPS: introduce C architecture-specific low-level init Signed-off-by: Antony Pavlov Acked-by: Jean-Christophe PLAGNIOL-VILLARD Signed-off-by: Sascha Hauer --- arch/mips/boot/Makefile | 1 + arch/mips/boot/main_entry.c | 43 +++++++++++++++++++++++++++++++++++++++++++ arch/mips/boot/start.S | 14 ++------------ 3 files changed, 46 insertions(+), 12 deletions(-) create mode 100644 arch/mips/boot/main_entry.c (limited to 'arch/mips') diff --git a/arch/mips/boot/Makefile b/arch/mips/boot/Makefile index f9151d28a1..d6d28ce652 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 0000000000..76fa492ca9 --- /dev/null +++ b/arch/mips/boot/main_entry.c @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2012 Antony Pavlov + * + * This file is part of barebox. + * See file CREDITS for list of people who contributed to this project. + * + * 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 + * + */ + +#include +#include +#include + +extern void start_barebox(void); + +void main_entry(void); + +/** + * Called plainly from assembler code + * + * @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 e8868e1dc0..dd302fcd35 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 -- cgit v1.2.3