From: Mikael Pettersson <mikpe@it.uu.se>
To: "Warlich, Christof" <christof.warlich@siemens.com>
Cc: Mikael Pettersson <mikpe@it.uu.se>,
Andi Kleen <andi@firstfloor.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: X86 fpu registers in a signal handler's ucontext
Date: Tue, 30 Apr 2013 16:42:00 +0200 [thread overview]
Message-ID: <20863.55352.431848.272078@pilspetsen.it.uu.se> (raw)
In-Reply-To: <6D83E89737156549AEA25EF9ED712C5DE208@DEFTHW99EK1MSX.ww902.siemens.net>
Warlich, Christof writes:
> Mikael Pettersson <mikpe@it.uu.se> writes:
> > Write to the fpstate ->mxcsr and ->swd fields in the sigaction handler's uc_mcontext.
>
> To me, "sigaction handler's uc_mcontext" sounds like userspace, which really confuses me:
> Even in most recent glibc-2.17, uc_mcontext is of type mcontext_t, which us defined as:
>
> typedef struct {
> gregset_t gregs;
> fpregset_t fpregs;
> } mcontext_t;
>
> typedef struct fpregset {
> union {
> struct fpchip_state {
> int state[27];
> int status;
> } fpchip_state;
> struct fp_emul_space {
> char fp_emul[246];
> char fp_epad[2];
> } fp_emul_space;
> int f_fpregs[62];
> } fp_reg_set;
> long int f_wregs[33];
> } fpregset_t;
>
> So there is no fpstate whatsoever.
You're looking at the wrong header: glibc-2.17/sysdeps/i386/sys/ucontext.h is legacy SVR4.
Instead look at glibc-2.17/sysdeps/unix/sysv/linux/x86/sys/ucontext.h.
(If the old one got installed on your system then something there is seriously wrong.)
The only quirk is that to access ->mxcsr on 32-bit you have to check if the high half of
->status contains FXSR_MAGIC and if so you need to cast that pointer to struct _fpstate*.
next prev parent reply other threads:[~2013-04-30 14:44 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-29 14:34 Warlich, Christof
2013-04-29 17:57 ` Andi Kleen
2013-04-30 6:35 ` Warlich, Christof
2013-04-30 11:28 ` Mikael Pettersson
2013-04-30 13:45 ` Warlich, Christof
2013-04-30 14:42 ` Mikael Pettersson [this message]
2013-05-02 5:42 ` Warlich, Christof
2013-05-02 7:06 ` richard -rw- weinberger
2013-05-02 7:43 ` Warlich, Christof
2013-05-02 9:04 ` Warlich, Christof
2013-05-02 11:12 ` Mikael Pettersson
2013-05-03 3:18 ` H. Peter Anvin
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=20863.55352.431848.272078@pilspetsen.it.uu.se \
--to=mikpe@it.uu.se \
--cc=andi@firstfloor.org \
--cc=christof.warlich@siemens.com \
--cc=linux-kernel@vger.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
all inboxes | Powered by JetHome®