All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dongliang Mu <mudongliangabcd@gmail.com>
To: kernelnewbies <kernelnewbies@kernelnewbies.org>
Subject: How to print __u128_t in kernel?
Date: Sat, 18 Sep 2021 21:35:33 +0800	[thread overview]
Message-ID: <CAD-N9QUudxrshjfTvfLjjTTwgqnXHDN_sfayeCFtk+aM9zkuLg@mail.gmail.com> (raw)

Hello everyone,

I encounter one object with __uint128_t type in the following code.
But I am not sure how to print the content of __uint128_t.

struct user_fpsimd_state {
__uint128_t vregs[32];
__u32 fpsr;
__u32 fpcr;
__u32 __reserved[2];
};

At first, I would like to use:
pr_alert("0x%lx %lx\n", i, (uint64_t)(fpreg.vregs[i] >> 64),
(uint64_t)(fpreg.vregs[i]));

However, gcc reports error with "-Werror" enabled:

In function ‘print_fpregs_in_coredump’:
error: iteration 32 invokes undefined behavior
[-Werror=aggressive-loop-optimizations]
   89 |   pr_alert("V%d 0x%lx %lx\n", i, (uint64_t)(fpreg.vregs[i] >> 64),

Any idea to eliminate this error?

--
My best regards to you.

     No System Is Safe!
     Dongliang Mu

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

             reply	other threads:[~2021-09-18 13:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-18 13:35 Dongliang Mu [this message]
2021-09-20 19:39 ` How to print __u128_t in kernel? Philipp Hortmann
2021-09-21  7:21   ` Bjørn Mork

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=CAD-N9QUudxrshjfTvfLjjTTwgqnXHDN_sfayeCFtk+aM9zkuLg@mail.gmail.com \
    --to=mudongliangabcd@gmail.com \
    --cc=kernelnewbies@kernelnewbies.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.