[U-Boot] [RFC PATCH 5/7] reboard: arm: Add processor function library
Simon Glass
sjg at chromium.org
Wed Dec 7 17:24:55 CET 2011
Hi Albert,
On Tue, Dec 6, 2011 at 11:44 PM, Albert ARIBAUD
<albert.u.boot at aribaud.net> wrote:
> Hi Simon,
>
> Le 22/11/2011 00:57, Simon Glass a écrit :
>
>> Add a library to hold ARM assembler code which is generic across all
>> ARM CPUs.
>>
>> Signed-off-by: Simon Glass<sjg at chromium.org>
>> ---
>> arch/arm/lib/Makefile | 1 +
>> arch/arm/lib/proc.S | 35 +++++++++++++++++++++++++++++++++++
>> 2 files changed, 36 insertions(+), 0 deletions(-)
>> create mode 100644 arch/arm/lib/proc.S
>>
>> diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile
>> index ca2802a..27749dc 100644
>> --- a/arch/arm/lib/Makefile
>> +++ b/arch/arm/lib/Makefile
>> @@ -50,6 +50,7 @@ endif
>>
>> ifndef CONFIG_SYS_LEGACY_BOARD
>> COBJS-y += arch_reloc.o
>> +SOBJS-y += proc.o
>> endif
>>
>> SRCS := $(GLSOBJS:.o=.S) $(GLCOBJS:.o=.c) \
>> diff --git a/arch/arm/lib/proc.S b/arch/arm/lib/proc.S
>> new file mode 100644
>> index 0000000..99a2944
>> --- /dev/null
>> +++ b/arch/arm/lib/proc.S
>> @@ -0,0 +1,35 @@
>> +/*
>> + * Copyright (c) 2011 The Chromium OS Authors.
>> + * 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
>> + */
>> +
>> +
>> +/**
>> + * Jump to board_init_r with a new stack pointer
>> + *
>> + * @param gd Pointer to global data
>> + * @param dest_addr Destination address from global data
>> + * @param func Address of board_init_r function (relocated)
>> + * @param sp New stack pointer
>> + */
>> +.globl proc_call_board_init_r
>> +proc_call_board_init_r:
>> + mov sp, r3
>> + /* jump to it ... */
>> + mov pc, r2
>
>
> What do we gain from this patch exactly?
The idea is to create a library to hold ARM assembler code which is
generic across all (or even most) ARM CPUs. So far it is just
relocation, but I feel that exception handling could move here too
eventually.
IMO start.S is a bad place for this sort of thing - it is private to
each cpu type so people tend to copy and paste large tracts of code
and it doesn't feel right to call back into your startup code later to
do things.
So I suggest a proc.S (or some other name) with processor-level
functions which are generic across ARM. We can then move this code
from all the little start.S files into one place, and maintain it more
easily.
Yes this is a trivial wee patch, but it's good to start the discussion
with something.
Regards,
Simon
>
> Amicalement,
> --
> Albert.
More information about the U-Boot
mailing list