public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: David Daney <ddaney@caviumnetworks.com>
To: Alexandre Oliva <aoliva@redhat.com>
Cc: linux-mips <linux-mips@linux-mips.org>, GCC <gcc@gcc.gnu.org>,
	 binutils <binutils@sourceware.org>,
	Prasun Kapoor <prasun.kapoor@caviumnetworks.com>,
	 Ralf Baechle <ralf@linux-mips.org>
Subject: Re: RFC: A new MIPS64 ABI
Date: Fri, 06 May 2011 17:00:00 -0000	[thread overview]
Message-ID: <4DC42919.5030403@caviumnetworks.com> (raw)
In-Reply-To: <or7ha4cjvn.fsf@livre.localdomain>

On 05/06/2011 01:29 AM, Alexandre Oliva wrote:
> On Feb 15, 2011, David Daney<ddaney@caviumnetworks.com>  wrote:
>
>> On 02/15/2011 09:56 AM, Alexandre Oliva wrote:
>>> On Feb 14, 2011, David Daney<ddaney@caviumnetworks.com>   wrote:
>
>>> So, sorry if this is a dumb question, but wouldn't it be much easier to
>>> keep on using sign-extended addresses, and just make sure the kernel
>>> never allocates a virtual memory range that crosses a sign-bit change,
>
>> No, it is not possible.  The MIPS (and MIPS64) hardware architecture
>> does not allow userspace access to addresses with the high bit (two
>> bits for mips64) set.
>
> Interesting.  I guess this makes it far easier to transition to the u32
> ABI: n32 addresses all have the 32-bit MSB bit clear, so n32 binaries
> can be used within u32 environments, as long as the environment refrains
> from using addresses that have the MSB bit set.
>

Correct.

> So we could switch lib32 to u32, have a machine-specific bit set for u32
> binaries, and if the kernel starts an executable or interpreter that has
> that bit clear, it will refrain from allocating any n32-invalid address
> for that process.  Furthermore, libc, upon loading a library, should be
> able to notify the kernel when an n32 library is to be loaded, to which
> the kernel would respond either with failure (if that process already
> uses u32-valid but n32-invalid addresses) or success (switching to n32
> mode if not in it already).
>
> Am I missing any other issues?

No, this is pretty much what Ralf and I came up with on IRC.

We tag u32 objects (in a similar manner to how non-executable stack is 
done).  The linker will propagate the u32 tag as it links things together.

u32 shared libraries are compatible with legacy n32 binaries as long as 
the OS doesn't map any memory where the address has bit 31 set.

When the OS loads an n32 executable it would check the u32 tag (both of 
the executable and ld.so) and adjust its memory allocation strategy.

The OS will continue to map the VDSO at the 2GB point.  This will cause 
the maximum size of any object to be compatible with the 32-bit n32 
ptrdiff_t.

I think once the OS puts a process into u32 mode, there is no going 
back.  We would just have ld.so refuse to load any shared objects that 
were not compatible with the current mode.

We would continue to place libraries in /lib32, /usr/lib32, 
/usr/local/lib32, etc.


David Daney


  reply	other threads:[~2011-05-06 17:00 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-14 20:29 David Daney
2011-02-15  0:15 ` Matt Thomas
2011-02-15  1:57   ` Paul Koning
2011-02-15  2:15     ` Joe Buck
2011-02-15  2:16       ` Paul Koning
2011-02-15  2:26       ` David Daney
2011-02-15  2:35         ` Matt Thomas
2011-02-15  2:43           ` David Daney
2011-02-15 17:33       ` Joseph S. Myers
2011-02-15 18:15         ` David Daney
2011-02-15  2:22   ` David Daney
2011-02-15  2:33     ` Matt Thomas
2011-02-15  2:50       ` David Daney
2011-02-15  3:02         ` Matt Thomas
2011-02-15 17:41           ` David Daney
2011-02-15 17:48             ` Paul Koning
2011-02-15 17:56 ` Alexandre Oliva
2011-02-15 18:08   ` David Daney
2011-05-06  8:31     ` Alexandre Oliva
2011-05-06 17:00       ` David Daney [this message]
2011-02-18  1:02 ` David Daney
     [not found] <4D5990A4.2050308__41923.1521235362$1297715435$gmane$org@caviumnetworks.com>
2011-02-21 19:45 ` Richard Sandiford
2011-05-09 14:27   ` Ralf Baechle
2011-05-09 17:47     ` David Daney

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=4DC42919.5030403@caviumnetworks.com \
    --to=ddaney@caviumnetworks.com \
    --cc=aoliva@redhat.com \
    --cc=binutils@sourceware.org \
    --cc=gcc@gcc.gnu.org \
    --cc=linux-mips@linux-mips.org \
    --cc=prasun.kapoor@caviumnetworks.com \
    --cc=ralf@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).