From: Lucas Dietrich <ld.adecy@gmail.com>
To: philmd@linaro.org
Cc: qemu-devel@nongnu.org, mrolnik@gmail.com,
qemu-trivial@nongnu.org, Lucas Dietrich <ld.adecy@gmail.com>
Subject: [PATCH] Fix handling of AVR interrupts above 33.
Date: Wed, 14 Jun 2023 16:07:49 +0200 [thread overview]
Message-ID: <20230614140748.3584-1-ld.adecy@gmail.com> (raw)
This commit addresses a bug in the AVR interrupt handling code.
The modification involves replacing the usage of the ctz32 function
with ctz64 to ensure proper handling of interrupts above 33 in the AVR
target.
Previously, timers 3, 4, and 5 interrupts were not functioning correctly
because most of their interrupt vectors are numbered above 33.
Signed-off-by: Lucas Dietrich <ld.adecy@gmail.com>
---
target/avr/helper.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/target/avr/helper.c b/target/avr/helper.c
index 2bad242a66..e6e7d51487 100644
--- a/target/avr/helper.c
+++ b/target/avr/helper.c
@@ -52,7 +52,7 @@ bool avr_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
}
if (interrupt_request & CPU_INTERRUPT_HARD) {
if (cpu_interrupts_enabled(env) && env->intsrc != 0) {
- int index = ctz32(env->intsrc);
+ int index = ctz64(env->intsrc);
cs->exception_index = EXCP_INT(index);
avr_cpu_do_interrupt(cs);
@@ -79,7 +79,7 @@ void avr_cpu_do_interrupt(CPUState *cs)
if (cs->exception_index == EXCP_RESET) {
vector = 0;
} else if (env->intsrc != 0) {
- vector = ctz32(env->intsrc) + 1;
+ vector = ctz64(env->intsrc) + 1;
}
if (avr_feature(env, AVR_FEATURE_3_BYTE_PC)) {
--
2.40.1
next reply other threads:[~2023-06-14 12:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-14 14:07 Lucas Dietrich [this message]
2023-06-14 12:22 ` [PATCH] Fix handling of AVR interrupts above 33 Philippe Mathieu-Daudé
2023-06-14 12:29 ` Michael Rolnik
2023-06-18 6:56 ` Michael Tokarev
2023-06-18 10:27 ` Philippe Mathieu-Daudé
-- strict thread matches above, loose matches on Subject: below --
2023-06-13 19:34 Lucas Dietrich
2023-06-14 4:32 ` Richard Henderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230614140748.3584-1-ld.adecy@gmail.com \
--to=ld.adecy@gmail.com \
--cc=mrolnik@gmail.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).