[U-Boot] [PATCH v2] nios2: convert copy_exception_trampoline to use dm cpu data

Ley Foon Tan lftan at altera.com
Fri Oct 9 04:51:57 CEST 2015


On Tue, Oct 6, 2015 at 2:55 PM, Thomas Chou <thomas at wytron.com.tw> wrote:
> Convert copy_exception_trampoline() to use dm cpu data.
>
> Signed-off-by: Thomas Chou <thomas at wytron.com.tw>
> ---
> v2
>   fix exception address references.
>
>  arch/nios2/cpu/cpu.c   | 24 ++++++++++++++++++++++++
>  arch/nios2/cpu/start.S | 24 +-----------------------
>  2 files changed, 25 insertions(+), 23 deletions(-)
>
> diff --git a/arch/nios2/cpu/cpu.c b/arch/nios2/cpu/cpu.c
> index 229a07b..5403c0d 100644
> --- a/arch/nios2/cpu/cpu.c
> +++ b/arch/nios2/cpu/cpu.c
> @@ -44,6 +44,27 @@ void dcache_disable(void)
>         flush_dcache(CONFIG_SYS_DCACHE_SIZE, CONFIG_SYS_DCACHELINE_SIZE);
>  }
>
> +/*
> + * COPY EXCEPTION TRAMPOLINE -- copy the tramp to the
> + * exception address. Define CONFIG_ROM_STUBS to prevent
> + * the copy (e.g. exception in flash or in other
> + * softare/firmware component).
> + */
> +#ifndef CONFIG_ROM_STUBS
> +static void copy_exception_trampoline(void)
> +{
> +       extern int _except_start, _except_end;
Can we use void* for _except_start and _except_end?
> +       void *except_target = (void *)gd->arch.exception_addr;
> +
> +       if (&_except_start != except_target) {
> +               memcpy(except_target, &_except_start,
> +                      &_except_end - &_except_start);
> +               flush_cache(gd->arch.exception_addr,
> +                           &_except_end - &_except_start);
> +       }
> +}
> +#endif
> +


More information about the U-Boot mailing list