From: Andrew Cagney <ac131313@cygnus.com>
To: Daniel Jacobowitz <drow@mvista.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFA] mips: Fix "info registers" output
Date: Sat, 09 Mar 2002 18:05:00 -0000 [thread overview]
Message-ID: <3C8ABF59.7080908@cygnus.com> (raw)
In-Reply-To: <20020307165956.A22042@nevyn.them.org>
> Meanwhile, Andrew, is this trivial fix OK? It just makes us decode the
> actual register values instead of two host pointers in our call to
> unpack_double.
I suspect the code was more broken then you thought!
If my memory is correct, the value is always stored LE in the register
pair. The code manages to do a double swap and consequently doesn't
correctly re-order the registers in the dbl_buffer.
It is also really broken when a 32 bit ABI is on a 64 bit ISA. (It very
nearly corrupts the stack).
> /* copy the two floats into one double, and unpack both */
> - memcpy (dbl_buffer, raw_buffer, 2 * REGISTER_RAW_SIZE (FP0_REGNUM));
> flt1 = unpack_double (builtin_type_float, raw_buffer[HI], &inv1);
> flt2 = unpack_double (builtin_type_float, raw_buffer[LO], &inv2);
> + memcpy (dbl_buffer, raw_buffer[HI], REGISTER_RAW_SIZE (FP0_REGNUM));
> + memcpy (dbl_buffer + REGISTER_RAW_SIZE (FP0_REGNUM),
> + raw_buffer[LO], REGISTER_RAW_SIZE (FP0_REGNUM));
> doub = unpack_double (builtin_type_double, dbl_buffer, &inv3);
>
I suspect a bigger improvement would look something like (I'm still not
100% sure of what goes where with BE/LE though :-)
if (!FP_REGISTER_DOUBLE)
char *raw_buffer[2];
char *dbl_buffer;
raw_buffer[0] = alloca; [1] = alloca; dbl_buffer = alloca;
read_relative_register(regnum+0, raw_buffer[0])
read_relative_register(regnum+1, raw_buffer[1])
if (BE)
reg_offset = (REGISTER_RAW_SIZE() == 8) ? 4 : 0;
type_float = builtin_type_ieee_single_big
type_double = builtin_type_ieee_double_big
memcpy dbl_buffer+4, raw_buffer[0] + reg_offset, 4);
memcpy dbl_buffer+0, raw_buffer[1] + reg_offset, 4);
else
reg_offset = 0
type_float = builtin_type_ieee_single_little
type_double = builtin_type_ieee_double_little
memcpy dbl_buffer+0, raw_buffer[0] + reg_offset, 4);
memcpy dbl_buffer+4, raw_buffer[1] + reg_offset, 4);
flt0 = unpack_double (type_float, raw_buffer[0] + reg_offset, &inv)
flt1 = unpack_double (type_float, raw_buffer[1] + reg_offset, &inv)
doub = unpack_double (type_double, dbl_buffer, &inv3)
Andrew
next prev parent reply other threads:[~2002-03-10 2:05 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20010619225007.A10141@nevyn.them.org>
2001-06-20 7:19 ` Andrew Cagney
2001-06-21 0:45 ` Eli Zaretskii
2001-06-21 8:37 ` Daniel Jacobowitz
2001-06-21 9:29 ` Eli Zaretskii
2001-06-21 9:44 ` Daniel Jacobowitz
2001-06-21 12:00 ` Eli Zaretskii
2001-06-21 13:12 ` Daniel Jacobowitz
2001-06-21 14:22 ` Don Howard
2002-03-07 13:59 ` Daniel Jacobowitz
2002-03-09 18:05 ` Andrew Cagney [this message]
2002-03-09 22:58 ` Daniel Jacobowitz
2002-03-10 8:30 ` Andrew Cagney
2002-03-10 9:00 ` Daniel Jacobowitz
2002-03-10 9:46 ` Andrew Cagney
2002-03-10 11:30 ` Daniel Jacobowitz
2002-03-10 12:45 ` Andrew Cagney
2002-03-10 14:26 ` Daniel Jacobowitz
2002-03-10 15:18 ` Andrew Cagney
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=3C8ABF59.7080908@cygnus.com \
--to=ac131313@cygnus.com \
--cc=drow@mvista.com \
--cc=gdb-patches@sources.redhat.com \
/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