[PATCH 02/10] bsps/arm: Support recent bootloaders starting kernel in HYP mode

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Jul 4 05:40:30 UTC 2016



On 04/07/16 01:52, ppisa at cmp.felk.cvut.cz wrote:
> From: Pavel Pisa <pisa at cmp.felk.cvut.cz>
>
> When HYP mode is detected at startup then setup HYP mode
> vectors table (for future extensions) clean exceptions
> switching to HYP mode and switch CPU to ARM SVC mode.
>
> BSPs which want to use this support need to include next option
> in their configure.ac
>
>    RTEMS_BSPOPTS_SET([BSP_START_IN_HYP_SUPPORT],[*],[1])
>    RTEMS_BSPOPTS_HELP([BSP_START_IN_HYP_SUPPORT], [Support start of BSP in ARM HYP mode])
>    AM_CONDITIONAL(BSP_START_IN_HYP_SUPPORT,test "$BSP_START_IN_HYP_SUPPORT" = "1")
>
> and need to include next lines in corresponding Makefile.am
>
>    if BSP_START_IN_HYP_SUPPORT
>    libbsp_a_SOURCES += ../shared/startup/bsp-start-in-hyp-support.S
>    endif
> ---
>   .../lib/libbsp/arm/shared/include/linker-symbols.h |  4 ++
>   c/src/lib/libbsp/arm/shared/include/start.h        | 13 +++-
>   c/src/lib/libbsp/arm/shared/start/start.S          | 73 +++++++++++++++++++-
>   .../arm/shared/startup/bsp-start-in-hyp-support.S  | 77 ++++++++++++++++++++++
>   c/src/lib/libbsp/arm/shared/startup/linkcmds.base  |  9 ++-
>   5 files changed, 170 insertions(+), 6 deletions(-)
>   create mode 100644 c/src/lib/libbsp/arm/shared/startup/bsp-start-in-hyp-support.S
>
> diff --git a/c/src/lib/libbsp/arm/shared/include/linker-symbols.h b/c/src/lib/libbsp/arm/shared/include/linker-symbols.h
> index 7446259..1a996f5 100644
> --- a/c/src/lib/libbsp/arm/shared/include/linker-symbols.h
> +++ b/c/src/lib/libbsp/arm/shared/include/linker-symbols.h
> @@ -59,6 +59,10 @@ LINKER_SYMBOL(bsp_stack_und_begin)
>   LINKER_SYMBOL(bsp_stack_und_end)
>   LINKER_SYMBOL(bsp_stack_und_size)
>   
> +LINKER_SYMBOL(bsp_stack_hyp_begin)
> +LINKER_SYMBOL(bsp_stack_hyp_end)
> +LINKER_SYMBOL(bsp_stack_hyp_size)
> +
>   LINKER_SYMBOL(bsp_stack_svc_begin)
>   LINKER_SYMBOL(bsp_stack_svc_end)
>   LINKER_SYMBOL(bsp_stack_svc_size)
> diff --git a/c/src/lib/libbsp/arm/shared/include/start.h b/c/src/lib/libbsp/arm/shared/include/start.h
> index f61eed3..bf8eed4 100644
> --- a/c/src/lib/libbsp/arm/shared/include/start.h
> +++ b/c/src/lib/libbsp/arm/shared/include/start.h
> @@ -45,6 +45,15 @@ extern "C" {
>   
>   #define BSP_START_DATA_SECTION __attribute__((section(".bsp_start_data")))
>   
> +/*
> +* Many ARM boot loaders pass arguments to loaded OS kernel
> +*/
> +#ifdef BSP_START_HOOKS_WITH_LOADER_ARGS
> +#define BSP_START_HOOKS_LOADER_ARGS int saved_psr, int saved_machid, int saved_dtb_adr
> +#else
> +#define BSP_START_HOOKS_LOADER_ARGS void
> +#endif
> +
>   /**
>   * @brief System start entry.
>   */
> @@ -57,7 +66,7 @@ void _start(void);
>   * stack pointers are initialized but before the copying of the exception
>   * vectors.
>   */
> -void bsp_start_hook_0(void);
> +void bsp_start_hook_0(BSP_START_HOOKS_LOADER_ARGS);

Do we really need the saved_psr and saved_machid? I think it is 
sufficient to pass the DTB address or NULL to bsp_start_hook_0() for all 
BSPs. We should avoid this conditional parameter list.

>   
>   /**
>   * @brief Start entry hook 1.
> @@ -65,7 +74,7 @@ void bsp_start_hook_0(void);
>   * This hook will be called from the start entry code after copying of the
>   * exception vectors but before the call to boot_card().
>   */
> -void bsp_start_hook_1(void);
> +void bsp_start_hook_1(BSP_START_HOOKS_LOADER_ARGS);

These parameters are not set up in start.S in this patch.

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.




More information about the devel mailing list