From: Michael Clark <mjc@sifive.com>
To: qemu-devel@nongnu.org
Cc: Michael Clark <mjc@sifive.com>,
Palmer Dabbelt <palmer@sifive.com>,
Peter Maydell <peter.maydell@linaro.org>,
Eric Blake <eblake@redhat.com>
Subject: [Qemu-devel] [PATCH v2] RISC-V: Fix riscv_isa_string, use popcount to count bits
Date: Sat, 10 Mar 2018 10:01:12 +1300 [thread overview]
Message-ID: <1520629272-98060-1-git-send-email-mjc@sifive.com> (raw)
Logic bug caused the string size calculation for the RISC-V
format ISA string to be small. This fix allows slack for rv128.
Cc: Palmer Dabbelt <palmer@sifive.com>
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael Clark <mjc@sifive.com>
---
target/riscv/cpu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
index 4851890..1456535 100644
--- a/target/riscv/cpu.c
+++ b/target/riscv/cpu.c
@@ -391,7 +391,7 @@ static const TypeInfo riscv_cpu_type_info = {
char *riscv_isa_string(RISCVCPU *cpu)
{
int i;
- size_t maxlen = 5 + ctz32(cpu->env.misa);
+ size_t maxlen = 8 + ctpop64(cpu->env.misa);
char *isa_string = g_new0(char, maxlen);
snprintf(isa_string, maxlen, "rv%d", TARGET_LONG_BITS);
for (i = 0; i < sizeof(riscv_exts); i++) {
--
2.7.0
next reply other threads:[~2018-03-09 21:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-09 21:01 Michael Clark [this message]
2018-03-10 21:25 ` [Qemu-devel] [PATCH v2] RISC-V: Fix riscv_isa_string, use popcount to count bits Philippe Mathieu-Daudé
2018-03-11 11:46 ` Philippe Mathieu-Daudé
2018-03-15 19:27 ` Peter Maydell
2018-03-16 17:03 ` Michael Clark
2018-03-16 20:55 ` Michael Clark
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=1520629272-98060-1-git-send-email-mjc@sifive.com \
--to=mjc@sifive.com \
--cc=eblake@redhat.com \
--cc=palmer@sifive.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@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).