From: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
To: Richard Henderson <richard.henderson@linaro.org>, qemu-devel@nongnu.org
Cc: qemu-riscv@nongnu.org, palmer@dabbelt.com,
alistair.francis@wdc.com, dbarboza@ventanamicro.com,
liwei1518@gmail.com, bmeng.cn@gmail.com
Subject: Re: [PATCH 1/1] disas/riscv: Guard dec->cfg dereference for host disassemble
Date: Sat, 7 Dec 2024 09:27:09 +0800 [thread overview]
Message-ID: <acbb7e5c-5f80-4d06-a569-53aeb8383e48@linux.alibaba.com> (raw)
In-Reply-To: <bbd8f614-f967-4f7f-82c1-eafdd9fbba68@linaro.org>
On 2024/12/6 21:36, Richard Henderson wrote:
> On 12/5/24 22:39, LIU Zhiwei wrote:
>>
>> Both zcmt and zcmp are not compatible with Zcd, as they reuse some
>> encodings from c.fsdsp.
>
> Ok, fair. A comment about conflicts at that point may help.
Ok.
>
>>
>> Zimop or Zcmop also overlap with other isa extensions, as they are
>> maybe-ops. Other extensions
>> such as zicfiss will reuse their encodings.
>>
>> I think we had better disassemble them to zicifss if it has been
>> implemented on the target cpu. Otherwise
>> we disassemble them to maybe-ops.
>
> My point is that they are only belong to zimop until they are
> assigned, like zicifss.
No, they always belong to zimop unless they are assigned to other
extensions. Applications built with zicfiss can also
run on cpu with zimop. In this case, the instructions of zicfiss should
be disassemble as zimop maybe-ops which has it's default behavior
different with the behavior of zicfiss.
Zimop belongs to mandate extension in RVB23 profile. There may be a
lot of cpus implement zimop but doesn't implement overlapping zicfiss.
So disassemble the applications to zimop is appropriate for these cpus.
> At that point they *have* a defined meaning in the standard isa.
>
> So, yes, disassemble as zicifss, but always, not "if it has been
> implemented in the target cpu".
>
>>>> + if (((i == 0) || cfg) && guard_func(cfg)) {
>>>
>>> This should be i == 0 || (cfg && guard_func(cfg)).
>>
>> OK. Although I think they are both right.
>
> i = 0
> cfg = NULL
>
> (0 == 0 || NULL) && guard_func(NULL)
> -> (true || false) && guard_func(NULL)
> -> true && guard_func(NULL)
> -> guard_func(NULL)
> -> boom.
>
> Or are you saying it won't go boom because we happen to know the 0th
> guard_func only returns true
Yes.
> ? There's still no reason to call it...
Agree. Will use this way.
Thanks,
Zhiwei
>
>
> r~
prev parent reply other threads:[~2024-12-07 1:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-06 3:24 [PATCH 1/1] disas/riscv: Guard dec->cfg dereference for host disassemble LIU Zhiwei
2024-12-06 3:36 ` Richard Henderson
2024-12-06 4:39 ` LIU Zhiwei
2024-12-06 13:36 ` Richard Henderson
2024-12-07 1:27 ` LIU Zhiwei [this message]
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=acbb7e5c-5f80-4d06-a569-53aeb8383e48@linux.alibaba.com \
--to=zhiwei_liu@linux.alibaba.com \
--cc=alistair.francis@wdc.com \
--cc=bmeng.cn@gmail.com \
--cc=dbarboza@ventanamicro.com \
--cc=liwei1518@gmail.com \
--cc=palmer@dabbelt.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=richard.henderson@linaro.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).