qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 13/26] target/nios2: Convert to CPUClass::tlb_fi


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH 13/26] target/nios2: Convert to CPUClass::tlb_fill
Date: Tue, 30 Apr 2019 10:44:02 +0100

On Wed, 3 Apr 2019 at 04:55, Richard Henderson
<address@hidden> wrote:
>
> Cc: Chris Wulff <address@hidden>
> Cc: Marek Vasut <address@hidden>
> Signed-off-by: Richard Henderson <address@hidden>
> ---
>  target/nios2/cpu.h    |   5 +-
>  target/nios2/cpu.c    |   5 +-
>  target/nios2/helper.c | 181 ++++++++++++++++++++----------------------
>  target/nios2/mmu.c    |  12 ---
>  4 files changed, 92 insertions(+), 111 deletions(-)
> --- a/target/nios2/helper.c
> +++ b/target/nios2/helper.c
> @@ -36,17 +36,6 @@ void nios2_cpu_do_interrupt(CPUState *cs)
>      env->regs[R_EA] = env->regs[R_PC] + 4;
>  }
>
> -int nios2_cpu_handle_mmu_fault(CPUState *cs, vaddr address, int size,
> -                               int rw, int mmu_idx)
> -{
> -    cs->exception_index = 0xaa;
> -    /* Page 0x1000 is kuser helper */
> -    if (address < 0x1000 || address >= 0x2000) {
> -        cpu_dump_state(cs, stderr, fprintf, 0);
> -    }
> -    return 1;
> -}

For user mode we used to set cs->exception_index to 0xaa...

> +bool nios2_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
> +                        MMUAccessType access_type, int mmu_idx,
> +                        bool probe, uintptr_t retaddr)
> +{
> +    Nios2CPU *cpu = NIOS2_CPU(cs);
> +    CPUNios2State *env = &cpu->env;
> +    unsigned int excp = EXCP_TLBD;

...but in the new code we end up setting it to
EXCP_TLBD, which is 12.

> +
> +#ifndef CONFIG_USER_ONLY

[...]

>  #endif /* !CONFIG_USER_ONLY */
> +
> +    cs->exception_index = excp;
> +    env->regs[CR_BADADDR] = address;
> +    cpu_loop_exit_restore(cs, retaddr);
> +}

We also set env->regs[CR_BADADDR], which we weren't
doing before.

We've lost the cpu_dump_state() as well (though I'm not
sure why that was there -- maybe stray debug printing?)

Otherwise the changes look OK (ie no-behaviour-change).

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]