All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ralf Baechle <ralf@linux-mips.org>
To: Johannes Stezenbach <js@linuxtv.org>,
	Daniel Jacobowitz <dan@debian.org>,
	"Maciej W. Rozycki" <macro@linux-mips.org>,
	linux-mips@linux-mips.org
Subject: Re: gdb vs. gdbserver with -mips3 / 32bitmode userspace
Date: Thu, 2 Feb 2006 13:43:29 +0000	[thread overview]
Message-ID: <20060202134329.GD4986@linux-mips.org> (raw)
In-Reply-To: <20060201194443.GB21871@linuxtv.org>

On Wed, Feb 01, 2006 at 08:44:43PM +0100, Johannes Stezenbach wrote:

> If I understand this correctly, gdbserver should check the
> register size supported by the OS, and communicate this to gdb?
> 
> I'm using a Linux kernel with CONFIG_32BIT, and if I understand
> the ptrace interface correctly, the registers as seen through
> ptrace are 32bit then, even though the CPU has 64bit registers.

Correct.  On 32-bit kernels Linux will largely forget about the 64-bitness
of the processor.  User processes will run with 64-bit (UX bit) disabled,
so they're never able to anything 64-bitish.  The kernel will only save
and restore the lower 32-bit of registers, so the upper 32-bit will be
lost.  That means only using the $zero register as 64-bit register is safe
and that's exploited by clear_page().  There are a few place where 64-bit
loads and stores are needed because particular hardware doesn't like being
talked to with 32-bit accesses; those accesses need make sure they're not
interrupted or bad things happen.  See the code for *readq() and write()
in <asm/io.h>.

Ages ago I tried leaving all the 64-bit functionality available as far as
possible even in 32-bit kernels.  It turned out to be example messy and I
was happy to have gotten rid of it, I think in 2.1.14.

> (I have no idea if the cp0 status suggested by others in this
> thread reflect CONFIG_32BIT vs. CONFIG_64BIT on Linux.)

On 32-bit kernels Linux will clear c0_status.kx, c0_status.ux and
c0_status.fr - on hardware were those bits exist at all, that is.

On 64-bit kernels Linux will set c0_status.kx.  It will also always set
c0_status.ux which means 64-bit operations are legal even for 32-bit
processes.  To my knowledge nobody is exploiting that; I guess it could
be exploited for a faster memcpy and similar.  Finally c0_status.fr which
will be set according to the ABI of the process, that is it'll be cleared
for o32 and set for N32 and N64 processes.

  Ralf

      reply	other threads:[~2006-02-02 13:39 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-31 17:15 gdb vs. gdbserver with -mips3 / 32bitmode userspace Johannes Stezenbach
2006-01-31 17:36 ` Maciej W. Rozycki
2006-01-31 18:14   ` Johannes Stezenbach
2006-01-31 18:42     ` Thiemo Seufer
2006-01-31 19:23       ` Johannes Stezenbach
2006-02-01 19:07         ` Johannes Stezenbach
2006-02-01 19:20           ` Johannes Stezenbach
2006-02-01 16:44   ` Daniel Jacobowitz
2006-02-01 16:53     ` Maciej W. Rozycki
2006-02-01 17:26     ` Michael Uhler
2006-02-01 17:26       ` Michael Uhler
2006-02-01 19:24       ` Daniel Jacobowitz
2006-02-02 13:26         ` Ralf Baechle
2006-02-01 19:44     ` Johannes Stezenbach
2006-02-02 13:43       ` Ralf Baechle [this message]

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=20060202134329.GD4986@linux-mips.org \
    --to=ralf@linux-mips.org \
    --cc=dan@debian.org \
    --cc=js@linuxtv.org \
    --cc=linux-mips@linux-mips.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 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.