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

Pavel Pisa pisa at cmp.felk.cvut.cz
Mon Jul 4 09:13:47 UTC 2016


Minor correction

On Monday 04 of July 2016 10:45:53 Pavel Pisa wrote:
> >
> > 	mov	r0, r4		/* original cpsr value */
> > 	mov	r1, r5		/* machine type number or ~0 for DT boot */
> > 	mov	r2, r6		/* physical address of ATAGs or DTB */
> >
> > before call to bsp_start_hook_1. And I liked the idea that
> > both (all) calls have same prototype.
>
> The approach is not to be done easily. There is
>
> bsp_vector_table_copy
>
> 	ldmia	r1!, {r2-r9}
> 	stmia	r0!, {r2-r9}
> 	ldmia	r1!, {r2-r9}
> 	stmia	r0!, {r2-r9}
>
> before
>
> 	bl	bsp_start_hook_1
>
> so that would require to add
>
> diff --git a/c/src/lib/libbsp/arm/shared/start/start.S
> b/c/src/lib/libbsp/arm/shared/start/start.S index 0848fff..8b9ec6b 100644
> --- a/c/src/lib/libbsp/arm/shared/start/start.S
> +++ b/c/src/lib/libbsp/arm/shared/start/start.S
> @@ -325,6 +325,8 @@ bsp_start_hook_0_done:
>          * vectors and the pointers to the default exception handlers.
>          */
>
> +       stmdb   sp!, {r4, r5, r6}
> +
>         ldr     r0, =bsp_vector_table_begin
>         adr     r1, bsp_start_vector_table_begin
>         cmp     r0, r1
> @@ -336,6 +338,8 @@ bsp_start_hook_0_done:
>
>  bsp_vector_table_copy_done:
>
> +       ldmia   sp!, {r0, r1, r2}
> +
>         SWITCH_FROM_ARM_TO_THUMB        r0

Has to be changed to other register

        SWITCH_FROM_ARM_TO_THUMB        r3

>
>         /* Branch to start hook 1 */
>
> So I am not sure if gain worth this price. The complete
> updated patch on on GitHub

with fix included

https://github.com/ppisa/rtems/commit/25a7041bca92e4f7a8b9a4906e0ee2b1955faac4

checked to pass correct initial PSR on RPi2 starting in HYP mode.

Best wishes,

            Pavel



More information about the devel mailing list