linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: linux-mips@vger.kernel.org
Cc: Paul Burton <paulburton@kernel.org>
Subject: [now with correct Cc] [RFC] weirdness in "MIPS: ptrace: introduce NT_MIPS_MSA regset"
Date: Sun, 24 Nov 2024 04:36:51 +0000	[thread overview]
Message-ID: <20241124043651.GA250598@ZenIV> (raw)

	Both msa_get() and msa_set() have very odd logics:

	} else if (sizeof(target->thread.fpu.fpr[0]) == regset->size) {

and

	if (sizeof(target->thread.fpu.fpr[0]) == regset->size) {

resp.

These instances occur in mips_regsets[REGSET_MSA] and in mips64_regsets[REGSET_MSA]
and both have ->size set to 16.  Fair enough, we are dealing with 128bit elements.

Now, the type of target->thread.fpu.fpr[0] is always union fpureg, i.e.

union fpureg {
        __u32   val32[FPU_REG_WIDTH / 32];
	__u64   val64[FPU_REG_WIDTH / 64];
};

and both members have the same size - FPU_REG_WIDTH / 8, now as well as at the
time this commit went in.  FPU_REG_WIDTH definition, now as then, is
#ifdef CONFIG_CPU_HAS_MSA
# define FPU_REG_WIDTH  128
#else
# define FPU_REG_WIDTH  64
#endif

Both msa_get() and msa_set() are under ifdef CONFIG_CPU_HAS_MSA.  In other words,
they are only going to be compiled if FPU_REG_WIDTH is 128 and sizeof(union fpreg)
is 16.

So it looks like both checks are constant true.  What am I missing here?

             reply	other threads:[~2024-11-24  4:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-24  4:36 Al Viro [this message]
2024-12-02 12:25 ` [now with correct Cc] [RFC] weirdness in "MIPS: ptrace: introduce NT_MIPS_MSA regset" Maciej W. Rozycki

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=20241124043651.GA250598@ZenIV \
    --to=viro@zeniv.linux.org.uk \
    --cc=linux-mips@vger.kernel.org \
    --cc=paulburton@kernel.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).