* [Qemu-devel] [PATCH] target-sh4: move intr_at_halt out of cpu_halted()
@ 2011-02-24 11:54 Aurelien Jarno
2011-02-24 12:05 ` [Qemu-devel] " Paolo Bonzini
0 siblings, 1 reply; 3+ messages in thread
From: Aurelien Jarno @ 2011-02-24 11:54 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, Aurelien Jarno
All targets except SH4 have the same cpu_halted() routine, and it has
only one caller. It is therefore a good candidate for inlining.
The difference is the handling of the intr_at_halt, which is necessary
to ignore SR.BL when sleeping. Move intr_at_halt handling out of it, by
setting this variable while executing the sleep instruction, and
clearing it when the CPU has been woken-up by an interrupt, whatever the
state of SR.BL.
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
target-sh4/exec.h | 1 -
target-sh4/helper.c | 2 +-
target-sh4/op_helper.c | 1 +
3 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/target-sh4/exec.h b/target-sh4/exec.h
index 2999c02..61bc121 100644
--- a/target-sh4/exec.h
+++ b/target-sh4/exec.h
@@ -37,7 +37,6 @@ static inline int cpu_halted(CPUState *env) {
return 0;
if (cpu_has_work(env)) {
env->halted = 0;
- env->intr_at_halt = 1;
return 0;
}
return EXCP_HALTED;
diff --git a/target-sh4/helper.c b/target-sh4/helper.c
index b9fcba6..1f0d15b 100644
--- a/target-sh4/helper.c
+++ b/target-sh4/helper.c
@@ -93,8 +93,8 @@ void do_interrupt(CPUState * env)
if (do_irq && !env->intr_at_halt) {
return; /* masked */
}
- env->intr_at_halt = 0;
}
+ env->intr_at_halt = 0;
if (do_irq) {
irq_vector = sh_intc_get_pending_vector(env->intc_handle,
diff --git a/target-sh4/op_helper.c b/target-sh4/op_helper.c
index 30f9842..2cd7fed 100644
--- a/target-sh4/op_helper.c
+++ b/target-sh4/op_helper.c
@@ -119,6 +119,7 @@ void helper_debug(void)
void helper_sleep(uint32_t next_pc)
{
env->halted = 1;
+ env->intr_at_halt = 1;
env->exception_index = EXCP_HLT;
env->pc = next_pc;
cpu_loop_exit();
--
1.7.2.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [Qemu-devel] Re: [PATCH] target-sh4: move intr_at_halt out of cpu_halted()
2011-02-24 11:54 [Qemu-devel] [PATCH] target-sh4: move intr_at_halt out of cpu_halted() Aurelien Jarno
@ 2011-02-24 12:05 ` Paolo Bonzini
2011-02-24 13:09 ` Aurelien Jarno
0 siblings, 1 reply; 3+ messages in thread
From: Paolo Bonzini @ 2011-02-24 12:05 UTC (permalink / raw)
To: Aurelien Jarno; +Cc: qemu-devel
On 02/24/2011 12:54 PM, Aurelien Jarno wrote:
> All targets except SH4 have the same cpu_halted() routine, and it has
> only one caller. It is therefore a good candidate for inlining.
>
> The difference is the handling of the intr_at_halt, which is necessary
> to ignore SR.BL when sleeping. Move intr_at_halt handling out of it, by
> setting this variable while executing the sleep instruction, and
> clearing it when the CPU has been woken-up by an interrupt, whatever the
> state of SR.BL.
>
> Cc: Paolo Bonzini<pbonzini@redhat.com>
> Signed-off-by: Aurelien Jarno<aurelien@aurel32.net>
Makes sense, thanks!
You may want to rename intr_at_halt to env->in_sleep or something like that.
Paolo
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Qemu-devel] Re: [PATCH] target-sh4: move intr_at_halt out of cpu_halted()
2011-02-24 12:05 ` [Qemu-devel] " Paolo Bonzini
@ 2011-02-24 13:09 ` Aurelien Jarno
0 siblings, 0 replies; 3+ messages in thread
From: Aurelien Jarno @ 2011-02-24 13:09 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: qemu-devel
On Thu, Feb 24, 2011 at 01:05:02PM +0100, Paolo Bonzini wrote:
> On 02/24/2011 12:54 PM, Aurelien Jarno wrote:
> >All targets except SH4 have the same cpu_halted() routine, and it has
> >only one caller. It is therefore a good candidate for inlining.
> >
> >The difference is the handling of the intr_at_halt, which is necessary
> >to ignore SR.BL when sleeping. Move intr_at_halt handling out of it, by
> >setting this variable while executing the sleep instruction, and
> >clearing it when the CPU has been woken-up by an interrupt, whatever the
> >state of SR.BL.
> >
> >Cc: Paolo Bonzini<pbonzini@redhat.com>
> >Signed-off-by: Aurelien Jarno<aurelien@aurel32.net>
>
> Makes sense, thanks!
>
> You may want to rename intr_at_halt to env->in_sleep or something like that.
>
Agreed, I will send a new patch.
--
Aurelien Jarno GPG: 1024D/F1BCDB73
aurelien@aurel32.net http://www.aurel32.net
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-02-24 13:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-24 11:54 [Qemu-devel] [PATCH] target-sh4: move intr_at_halt out of cpu_halted() Aurelien Jarno
2011-02-24 12:05 ` [Qemu-devel] " Paolo Bonzini
2011-02-24 13:09 ` Aurelien Jarno
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.