This patch fixes processing of rfi instructions in icount mode.
PATCH 1/1 This patch fixes processing of rfi instructions in icount mode.
From: Maria Klimushenkova <[email protected]>
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.
--- target/ppc/translate.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
target/ppc/translate.c +12 -0
@@ -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 }
Quoted 37 lines · Pavel Dovgalyuk
From: Maria Klimushenkova <[email protected]>
In this mode writing to interrupt/peripheral state is controlled by
can_do_ioflag. This flag must be set explicitly before helper function invocation.Signed-off-by Maria Klimushenkova <[email protected]>Signed-off-by Pavel Dovgalyuk <[email protected]>--- target/ppc/translate.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)target/ppc/translate.c +7
-0@@ -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 ) {
target/ppc/translate.c static void gen_rfid(DisasContext *ctx) · line 3911
Quoted 10 lines
target/ppc/translate.c +5
-0+ 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:
ATB,
Mark.
Quoted 53 lines · Mark Cave-Ayland
Quoted 37 lines · Pavel Dovgalyuk
From: Maria Klimushenkova <[email protected]>
In this mode writing to interrupt/peripheral state is controlled by
can_do_ioflag. This flag must be set explicitly before helper function invocation.Signed-off-by Maria Klimushenkova <[email protected]>Signed-off-by Pavel Dovgalyuk <[email protected]>--- target/ppc/translate.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)target/ppc/translate.c +7
-0@@ -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 ) {target/ppc/translate.c static void gen_rfid(DisasContext *ctx) · line 3911
Quoted 10 lines
target/ppc/translate.c +5
-0+ 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:
Quoted 1 line
Tested-by Mark Cave-Ayland <[email protected]>
Good enough for me. Applied to ppc-for-3.1.
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson