On 30/10/2018 12:21, Pavel Dovgalyuk wrote:

> From: Maria Klimushenkova <maria.klimushenk...@ispras.ru>
> 
> In this mode writing to interrupt/peripheral state is controlled
> by can_do_io flag. This flag must be set explicitly before helper
> function invocation.
> 
> Signed-off-by: Maria Klimushenkova <maria.klimushenk...@ispras.ru>
> Signed-off-by: Pavel Dovgalyuk <pavel.dovga...@ispras.ru>
> ---
>  target/ppc/translate.c |   12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/target/ppc/translate.c b/target/ppc/translate.c
> index 987ce6e..980862c 100644
> --- a/target/ppc/translate.c
> +++ b/target/ppc/translate.c
> @@ -3878,9 +3878,15 @@ static void gen_rfi(DisasContext *ctx)
>      }
>      /* Restore CPU state */
>      CHK_SV;
> +    if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) {
> +        gen_io_start();
> +    }
>      gen_update_cfar(ctx, ctx->base.pc_next - 4);
>      gen_helper_rfi(cpu_env);
>      gen_sync_exception(ctx);
> +    if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) {
> +        gen_io_end();
> +    }
>  #endif
>  }
>  
> @@ -3892,9 +3898,15 @@ static void gen_rfid(DisasContext *ctx)
>  #else
>      /* Restore CPU state */
>      CHK_SV;
> +    if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) {
> +        gen_io_start();
> +    }
>      gen_update_cfar(ctx, ctx->base.pc_next - 4);
>      gen_helper_rfid(cpu_env);
>      gen_sync_exception(ctx);
> +    if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) {
> +        gen_io_end();
> +    }
>  #endif
>  }

I've given this patch a spin on top of ppc-for-3.1 and it allows my test images 
to
boot with icount enabled without asserting, so:

Tested-by: Mark Cave-Ayland <mark.cave-ayl...@ilande.co.uk>


ATB,

Mark.

Reply via email to