From: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
To: Markus Armbruster <armbru@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] target-tricore: Possible bug in get_mtcr()
Date: Tue, 20 Jan 2015 17:49:38 +0000 [thread overview]
Message-ID: <54BE9532.9050701@mail.uni-paderborn.de> (raw)
In-Reply-To: <87oaptn6u3.fsf@blackfin.pond.sub.org>
Hi Markus,
On 01/20/2015 09:23 AM, Markus Armbruster wrote:
> Coverity[*] points out:
>
> *** CID 1264337: Logically dead code (DEADCODE)
> /target-tricore/translate.c: 348 in gen_mtcr()
> 342 #define E(ADDRESS, REG, FEATURE) A(ADDRESS, REG, FEATURE)
> 343 static inline void gen_mtcr(CPUTriCoreState *env, DisasContext
> *ctx, TCGv r1,
> 344 int32_t offset)
> 345 {
> 346 if (ctx->hflags & TRICORE_HFLAG_SM) {
> 347 /* since we're caching PSW make this a special case */
> >>> CID 1264337: Logically dead code (DEADCODE)
> >>> Execution cannot reach this statement: "if (offset == 65028) {
> ge...".
> 348 if (offset == 0xfe04) {
> 349 gen_helper_psw_write(cpu_env, r1);
> 350 } else {
> 351 switch (offset) {
> 352 #include "csfr.def"
> 353 }
>
> Correct, because TRICORE_HFLAG_SM is zero:
>
> #define TRICORE_HFLAG_UM0 0x00002 /* user mode-0 flag */
> #define TRICORE_HFLAG_UM1 0x00001 /* user mode-1 flag */
> #define TRICORE_HFLAG_SM 0x00000 /* kernel mode flag */
Good catch!
>
> Shouls this perhaps be (ctx->hflags & (1 << TRICORE_HFLAG_SM))?
Close. It should be:
#define TRICORE_HFLAG_KUU 0x3
...
((ctx->hflags & TRICORE_HFLAG_KUU) == TRICORE_HFLAG_SM)
I will send a patch for this.
Thanks,
Bastian
> [*] https://scan.coverity.com/projects/378
>
prev parent reply other threads:[~2015-01-20 16:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-20 9:23 [Qemu-devel] target-tricore: Possible bug in get_mtcr() Markus Armbruster
2015-01-20 17:49 ` Bastian Koppelmann [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=54BE9532.9050701@mail.uni-paderborn.de \
--to=kbastian@mail.uni-paderborn.de \
--cc=armbru@redhat.com \
--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).