From: "Maciej W. Rozycki" <macro@mips.com>
To: Daniel Jacobowitz <drow@false.org>
Cc: gdb-patches@sourceware.org, David Ung <davidu@mips.com>,
"Maciej W. Rozycki" <macro@linux-mips.org>
Subject: Re: mips-tdep.c: Sign-extend pointers for n32
Date: Wed, 19 Dec 2007 15:27:00 -0000 [thread overview]
Message-ID: <Pine.LNX.4.61.0712181902330.23732@perivale.mips.com> (raw)
In-Reply-To: <20071216184625.GA22905@caradoc.them.org>
On Sun, 16 Dec 2007, Daniel Jacobowitz wrote:
> Why just pointers? I'm not entirely sure what's going on above in the
> float case, but in the integer case this seems clearly wrong. Zero
> extension is probably "right" for trailing bits of structures but what
> about negative integers?
You are quite right here -- I have checked the N32 ABI document and it
says:
"32-bit integer (int) parameters are always sign-extended when passed in
registers, whether of signed or unsigned type. [This issue does not arise
in the o32-bit ABI.]"
It does not actually say anything about pointers beyond:
"All pointers and addresses are 32-bit objects. [Under 64, pointers and
addresses are 64bits.]"
but I gather this is because the document was meant to specify a user mode
ABI for programs run under IRIX only, so addresses with the bit #31 set
were not expected to be relevant.
I have regression-tested the following rewrite of the original patch
using the mipsisa32-sde-elf target, with the mips-sim-sde64/-mips64/-EB
and mips-sim-sde64/-mips64/-EL boards, with the results the same as the
original.
2007-12-19 David Ung <davidu@mips.com>
Maciej W. Rozycki <macro@mips.com>
* mips-tdep.c (mips_n32n64_push_dummy_call): Sign-extend 32-bit
pointers and integers as required by the ABI.
OK to apply?
Maciej
12741-0.diff
Index: binutils-quilt/src/gdb/mips-tdep.c
===================================================================
--- binutils-quilt.orig/src/gdb/mips-tdep.c 2007-12-19 15:09:31.000000000 +0000
+++ binutils-quilt/src/gdb/mips-tdep.c 2007-12-19 15:10:13.000000000 +0000
@@ -3184,8 +3184,17 @@
purpose register. */
if (argreg <= MIPS_LAST_ARG_REGNUM)
{
- LONGEST regval =
- extract_unsigned_integer (val, partial_len);
+ LONGEST regval;
+
+ /* Sign extend pointers and 32-bit integers;
+ everything else is taken as is. */
+
+ if (partial_len == 4 &&
+ (typecode == TYPE_CODE_PTR
+ || typecode == TYPE_CODE_INT))
+ regval = extract_signed_integer (val, partial_len);
+ else
+ regval = extract_unsigned_integer (val, partial_len);
/* A non-floating-point argument being passed in a
general register. If a struct or union, and if
next prev parent reply other threads:[~2007-12-19 15:20 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-25 14:43 Maciej W. Rozycki
2007-12-16 18:49 ` Daniel Jacobowitz
2007-12-19 15:27 ` Maciej W. Rozycki [this message]
2007-12-19 15:28 ` Daniel Jacobowitz
2007-12-19 16:16 ` Maciej W. Rozycki
2007-12-19 17:08 ` Daniel Jacobowitz
2007-12-20 16:41 ` Maciej W. Rozycki
2007-12-20 17:07 ` Daniel Jacobowitz
2007-12-20 17:18 ` Maciej W. Rozycki
2007-12-20 19:37 ` Daniel Jacobowitz
2007-12-21 4:36 ` Joel Brobecker
2007-12-21 11:34 ` Maciej W. Rozycki
2007-12-21 11:51 ` Joel Brobecker
2007-12-21 12:02 ` Maciej W. Rozycki
2007-12-22 5:30 ` Joel Brobecker
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=Pine.LNX.4.61.0712181902330.23732@perivale.mips.com \
--to=macro@mips.com \
--cc=davidu@mips.com \
--cc=drow@false.org \
--cc=gdb-patches@sourceware.org \
--cc=macro@linux-mips.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