All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] microblaze: Add support for the sleep insn
@ 2013-03-29 21:44 edgar.iglesias
  2013-03-30 13:45 ` Blue Swirl
  0 siblings, 1 reply; 3+ messages in thread
From: edgar.iglesias @ 2013-03-29 21:44 UTC (permalink / raw)
  To: qemu-devel

From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
---
 target-microblaze/translate.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/target-microblaze/translate.c b/target-microblaze/translate.c
index a74da8e..21a7119 100644
--- a/target-microblaze/translate.c
+++ b/target-microblaze/translate.c
@@ -1317,6 +1317,21 @@ static void dec_br(DisasContext *dc)
     /* Memory barrier.  */
     mbar = (dc->ir >> 16) & 31;
     if (mbar == 2 && dc->imm == 4) {
+        /* mbar IMM & 16 decodes to sleep.  */
+        if (dc->rd & 16) {
+            TCGv_i32 tmp = tcg_const_i32(EXCP_HLT);
+
+            LOG_DIS("sleep\n");
+
+            t_sync_flags(dc);
+            tcg_gen_st_i32(tcg_const_i32(1), cpu_env,
+                           -offsetof(MicroBlazeCPU, env)
+                           +offsetof(CPUState, halted));
+            tcg_gen_movi_tl(cpu_SR[SR_PC], dc->pc + 4);
+            gen_helper_raise_exception(cpu_env, tmp);
+            tcg_temp_free_i32(tmp);
+            return;
+        }
         LOG_DIS("mbar %d\n", dc->rd);
         /* Break the TB.  */
         dc->cpustate_changed = 1;
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] microblaze: Add support for the sleep insn
  2013-03-29 21:44 [Qemu-devel] [PATCH] microblaze: Add support for the sleep insn edgar.iglesias
@ 2013-03-30 13:45 ` Blue Swirl
  2013-03-30 14:13   ` Edgar E. Iglesias
  0 siblings, 1 reply; 3+ messages in thread
From: Blue Swirl @ 2013-03-30 13:45 UTC (permalink / raw)
  To: Edgar E. Iglesias; +Cc: qemu-devel

On Fri, Mar 29, 2013 at 9:44 PM,  <edgar.iglesias@gmail.com> wrote:
> From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
>
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
> ---
>  target-microblaze/translate.c |   15 +++++++++++++++
>  1 file changed, 15 insertions(+)
>
> diff --git a/target-microblaze/translate.c b/target-microblaze/translate.c
> index a74da8e..21a7119 100644
> --- a/target-microblaze/translate.c
> +++ b/target-microblaze/translate.c
> @@ -1317,6 +1317,21 @@ static void dec_br(DisasContext *dc)
>      /* Memory barrier.  */
>      mbar = (dc->ir >> 16) & 31;
>      if (mbar == 2 && dc->imm == 4) {
> +        /* mbar IMM & 16 decodes to sleep.  */
> +        if (dc->rd & 16) {
> +            TCGv_i32 tmp = tcg_const_i32(EXCP_HLT);
> +
> +            LOG_DIS("sleep\n");
> +
> +            t_sync_flags(dc);
> +            tcg_gen_st_i32(tcg_const_i32(1), cpu_env,

This leaks the result of tcg_const_i32(1).

> +                           -offsetof(MicroBlazeCPU, env)
> +                           +offsetof(CPUState, halted));
> +            tcg_gen_movi_tl(cpu_SR[SR_PC], dc->pc + 4);
> +            gen_helper_raise_exception(cpu_env, tmp);
> +            tcg_temp_free_i32(tmp);
> +            return;
> +        }
>          LOG_DIS("mbar %d\n", dc->rd);
>          /* Break the TB.  */
>          dc->cpustate_changed = 1;
> --
> 1.7.9.5
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] microblaze: Add support for the sleep insn
  2013-03-30 13:45 ` Blue Swirl
@ 2013-03-30 14:13   ` Edgar E. Iglesias
  0 siblings, 0 replies; 3+ messages in thread
From: Edgar E. Iglesias @ 2013-03-30 14:13 UTC (permalink / raw)
  To: Blue Swirl; +Cc: qemu-devel

On Sat, Mar 30, 2013 at 01:45:26PM +0000, Blue Swirl wrote:
> On Fri, Mar 29, 2013 at 9:44 PM,  <edgar.iglesias@gmail.com> wrote:
> > From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
> >
> > Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
> > ---
> >  target-microblaze/translate.c |   15 +++++++++++++++
> >  1 file changed, 15 insertions(+)
> >
> > diff --git a/target-microblaze/translate.c b/target-microblaze/translate.c
> > index a74da8e..21a7119 100644
> > --- a/target-microblaze/translate.c
> > +++ b/target-microblaze/translate.c
> > @@ -1317,6 +1317,21 @@ static void dec_br(DisasContext *dc)
> >      /* Memory barrier.  */
> >      mbar = (dc->ir >> 16) & 31;
> >      if (mbar == 2 && dc->imm == 4) {
> > +        /* mbar IMM & 16 decodes to sleep.  */
> > +        if (dc->rd & 16) {
> > +            TCGv_i32 tmp = tcg_const_i32(EXCP_HLT);
> > +
> > +            LOG_DIS("sleep\n");
> > +
> > +            t_sync_flags(dc);
> > +            tcg_gen_st_i32(tcg_const_i32(1), cpu_env,
> 
> This leaks the result of tcg_const_i32(1).

Fixed in v2, thanks

Edgar

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-03-30 14:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-29 21:44 [Qemu-devel] [PATCH] microblaze: Add support for the sleep insn edgar.iglesias
2013-03-30 13:45 ` Blue Swirl
2013-03-30 14:13   ` Edgar E. Iglesias

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.