On 6 May 2014 07:08, Edgar E. Iglesias <edgar.igles...@gmail.com> wrote:
> From: "Edgar E. Iglesias" <edgar.igles...@xilinx.com>
>
> Maps a given EL to the corresponding MMU index.
>
> Signed-off-by: Edgar E. Iglesias <edgar.igles...@xilinx.com>
> ---
>  target-arm/cpu.h           | 21 ++++++++++++++++++++-
>  target-arm/translate-a64.c |  8 ++------
>  2 files changed, 22 insertions(+), 7 deletions(-)
>
> diff --git a/target-arm/cpu.h b/target-arm/cpu.h
> index ff86250..938f389 100644
> --- a/target-arm/cpu.h
> +++ b/target-arm/cpu.h
> @@ -1086,9 +1086,28 @@ static inline CPUARMState *cpu_init(const char 
> *cpu_model)
>  #define MMU_MODE0_SUFFIX _kernel
>  #define MMU_MODE1_SUFFIX _user
>  #define MMU_USER_IDX 1
> +static inline int arm_el_to_mmu_idx(int current_el)
> +{
> +#ifdef CONFIG_USER_ONLY
> +    return MMU_USER_IDX;
> +#else
> +    switch (current_el) {
> +    case 0:
> +        return MMU_USER_IDX;
> +    case 1:
> +        return 0;
> +    default:
> +        /* Unsupported EL.  */
> +        assert(0);
> +        return 0;
> +    }
> +#endif

Can we just make the EL and the MMU index the same thing,
or is secure-vs-nonsecure going to need its own MMU
indexes anyway?

thanks
-- PMM

Reply via email to