From: Jan Kiszka <jan.kiszka@siemens.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] x86: FP binary format and overlapping with MMX
Date: Wed, 05 Nov 2008 19:19:55 +0100 [thread overview]
Message-ID: <4911E3CB.1040109@siemens.com> (raw)
Hi,
while refactoring and enhancing the x86 part of gdbstub, I came across
an issue in the way CPUX86State.fpregs is stored: According to Intel
specs, floating point register bits 0..63 map on MMX register bits
0..63. But this union
union {
#ifdef USE_X86LDOUBLE
CPU86_LDouble d __attribute__((aligned(16)));
#else
CPU86_LDouble d;
#endif
MMXReg mmx;
} fpregs[8];
only ensures this if
a) the host is little endian (due to sizeof(d) > sizeof(mmx)) and
b) CPU86_LDouble is actually laid out as on real x86.
How a) can be violated is obvious, but what about b)?
It seems that qemu is using different binary representations, depending
on the FPU emulation mode (native vs. soft). On x86 emulating x86, this
is no issue, as the double extended float type (80 bits) is natively
available and used. But when going to other host archs, possibly
defining CPU86_LDouble as float128, correctness is lost, specifically
/wrt saving/restoring the cruft to/from memory where the guest can
fiddle with individual bits. Moreover, that's where I came from,
byte-swapping for gdb becomes impossible: should I swap MMX or should I
convert/swap FP representation?
Thoughts on this welcome!
Jan
--
Siemens AG, Corporate Technology, CT SE 2 ES-OS
Corporate Competence Center Embedded Linux
reply other threads:[~2008-11-05 18:20 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=4911E3CB.1040109@siemens.com \
--to=jan.kiszka@siemens.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 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.